DynamicLocalDateLocalizer

Localizes a LocalDate dynamically (either absolute or relative to a Zoned<Instant> reference point).

This class chooses between formatting with a RelativeLocalDateLocalizer (if the difference is within the configured range), or falls back to absolute formatting via LocalDateLocalizer.

Create once and re-use for localizing multiple values with the same options. Use LocalDate.localizeDynamic or LocalDate.localizeDynamicAsFlow for one-off localizations.

Examples:

  • yesterday

  • 1 day ago

  • in 5 days

  • 01/01/2026

  • January 1 2026

See also

Constructors

Link copied to clipboard
constructor(options: DynamicLocalDateOptions, locale: PlatformLocale = getDefaultLocale())

Functions

Link copied to clipboard
open override fun localize(value: LocalDate, reference: Zoned<Instant>): TickingValue<String>
Link copied to clipboard
fun <T> PolyglotReferenceValueLocalizer<T>.localize(value: T, clock: Clock = Clock.System): TickingValue<String>

Localizes value by using the given clock's Clock.now as a reference point, rather than passing the reference explicitly.

Link copied to clipboard
fun <T> PolyglotReferenceValueLocalizer<T>.localizeAsFlow(value: T, clock: Clock = Clock.System, maxTick: Duration? = null): Flow<String>

Localizes value by using the given clock's Clock.now as a reference point and returns a Flow that emits updated values based on the underlying TickingValue.nextTick. This function assumes that the given clock moves forward linearly.