1 Commits

Author SHA1 Message Date
10efec4733 DateUtils: make duration rounded up to minutes 2026-03-05 23:32:16 +01:00

View File

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