1 Commits

Author SHA1 Message Date
80fa8d8294 DateUtils: make duration rounded up to minutes 2026-03-06 12:03:48 +01:00

View File

@@ -9,11 +9,12 @@ import java.util.Date
class DateUtils {
companion object {
/**
* Format time duration in seconds as e.g. "2 hours, 1 min", rounded up to minutes.
* Format time duration in seconds as e.g. "2 hours, 1 min", rounded to minutes.
* Used for the duration to the next/previous event in the event details dialog.
*/
fun formatTimeDuration(context: Context, secondsDiff: Long): String {
return formatTimeDurationExact(context, 60L + secondsDiff - (secondsDiff % 60L))
val adjusted = (secondsDiff + 30) - (secondsDiff + 30) % 60
return formatTimeDurationExact(context, adjusted)
}
fun formatTimeDurationExact(context: Context, secondsDiff: Long): String {