DynamicDateAbsoluteTimeLocalizer
class DynamicDateAbsoluteTimeLocalizer(options: DynamicDateAbsoluteTimeOptions, locale: PlatformLocale = getDefaultLocale()) : PolyglotReferenceValueLocalizer<LocalDateTime> (source)
Localizes a LocalDateTime dynamically (either absolute or relative to a Zoned<Instant> reference point).
This class chooses between formatting with a RelativeDateAbsoluteTimeLocalizer (if the difference is within the configured range), or falls back to absolute formatting via LocalDateLocalizer.
So, in essence, the time is always localized absolutely, while the date is dynamic.
Create once and re-use for localizing multiple values with the same options. Use LocalDateTime.localizeDynamicDateAbsoluteTime or LocalDateTime.localizeDynamicDateAbsoluteTimeAsFlow for one-off localizations.
Examples:
yesterday at 9:00 AM1 day ago at 18:00next Sunday at 12:00 PMJanuary 1 2026 at 8 in the morning1/1/26, 8 PM
See also
Functions
Link copied to clipboard
Link copied to clipboard
fun <T> PolyglotReferenceValueLocalizer<T>.localizeAsFlow(value: T, clock: Clock = Clock.System, maxTick: Duration? = null): Flow<String>