DynamicDateAbsoluteTimeLocalizer

class DynamicDateAbsoluteTimeLocalizer(options: DynamicDateAbsoluteTimeOptions = DynamicDateAbsoluteTimeOptions(), locale: PlatformLocale = getDefaultLocale()) : PolyglotReferenceDateTimeLocalizer<LocalDateTime>

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 AM

  • 1 day ago at 18:00

  • next Sunday at 12:00 PM

  • January 1 2026 at 8 in the morning

  • 1/1/26, 8 PM

See also

Constructors

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

Functions

Link copied to clipboard
open override fun localize(value: LocalDateTime, reference: Zoned<Instant>): TickingValue<String>