Use formatter for LLS duration

This commit is contained in:
ganfra 2026-03-24 10:15:25 +01:00
parent 6507a2e8cb
commit dee8ce27e7
12 changed files with 275 additions and 24 deletions

View file

@ -11,6 +11,19 @@ package io.element.android.libraries.dateformatter.api
import java.util.Locale
import kotlin.time.Duration
/**
* Formats a duration in a localized, human-readable way.
* Uses the largest appropriate unit (hours, minutes, or seconds).
*
* Examples (in English):
* - 2 hours 30 minutes "3 hours" (rounded)
* - 45 minutes "45 minutes"
* - 30 seconds "30 seconds"
*/
interface DurationFormatter {
fun format(duration: Duration): String
}
/**
* Convert milliseconds to human readable duration.
* Hours in 1 digit or more.