Package-level declarations

Types

Link copied to clipboard
data class DateComponents(val eraStyle: EraStyle? = null, val yearStyle: YearStyle = YearStyle.NUMERIC_PADDED_4_DIGITS, val monthStyle: MonthStyle, val dayOfMonthStyle: DayOfMonthStyle = DayOfMonthStyle.NUMERIC, val dayOfWeekStyle: DayOfWeekStyle? = null) : DateStyleOptions, ComponentsOptions.Date.Components

Class defining the style for each component of a date (year, month and day).

Link copied to clipboard
data class DateOptions(val styleOptions: DateStyleOptions)

Simple container class for DateStyleOptions.

Link copied to clipboard

Defines a preset date style for localizing a date (year, month and day).

Link copied to clipboard
sealed interface DateStyleOptions

Defines the localization style for a date (year, month and day).

Link copied to clipboard
actual class DurationLocalizer : PolyglotValueLocalizer<ERROR CLASS: Symbol not found for Duration, String>

Localizer for Duration.

Link copied to clipboard
data class DurationOptions(val minUnit: DurationUnit = DurationUnit.SECONDS, val maxUnits: Int = 2, val omitZeros: Boolean = true, val style: DurationStyle = DurationStyle.WIDE, val ifZeroLocalization: (PlatformLocale) -> String? = { null })

Localization options for DurationLocalizer and Duration.localize

Link copied to clipboard
@RequiresOptIn(message = "This API is experimental. It could change or be dropped in the future without notice.")
annotation class ExperimentalTickingDurationLocalizer
Link copied to clipboard
@RequiresOptIn(message = "This API is experimental. It could change or be dropped in the future without notice.")
annotation class ExperimentalZonedLocalizer
Link copied to clipboard
actual class LocalDateLocalizer : PolyglotDateTimeLocalizer<ERROR CLASS: Symbol not found for LocalDate>

Localizer for LocalDate.

Link copied to clipboard
actual class LocalDateTimeLocalizer : PolyglotDateTimeLocalizer<ERROR CLASS: Symbol not found for LocalDateTime>

Localizer for LocalDateTime.

Link copied to clipboard

Localization options for LocalDateTimeLocalizer and LocalDateTime.parse.

Link copied to clipboard
actual class LocalTimeLocalizer : PolyglotDateTimeLocalizer<ERROR CLASS: Symbol not found for LocalTime>

Localizer for LocalTime.

Link copied to clipboard

Localizes a Duration in the same exact way as a DurationLocalizer, but this is meant to be used to localize duration values that change over time (e.g. a countdown). For static durations use DurationLocalizer instead.

Link copied to clipboard
data class TickingDurationOptions(val durationOptions: DurationOptions = DurationOptions(), val abs: Boolean = false)
Link copied to clipboard
sealed interface TimeComponents : TimeStyleOptions

Interface defining the style for each component of a time.

Link copied to clipboard
data class TimeOptions<out SO : TimeStyleOptions>(val styleOptions: SO, val hourCycle: HourCycle? = null)

Options to pass when localizing time.

Link copied to clipboard
sealed interface TimeStyle : TimeStyleOptions

Defines a preset time style for localizing a time.

Link copied to clipboard
sealed interface TimeStyleOptions

Options to pass to TimeOptions.styleOptions, that define the style of each time component.

Link copied to clipboard

Localizer for years (Int).

Localizer for years (Int).

Localizer for years (Int).

Link copied to clipboard
actual class YearMonthLocalizer : PolyglotDateTimeLocalizer<ERROR CLASS: Symbol not found for YearMonth>

Localizer for YearMonth.

Link copied to clipboard
data class YearMonthOptions(val eraStyle: EraStyle? = null, val yearStyle: YearStyle = YearStyle.NUMERIC, val monthStyle: MonthStyle?) : ComponentsOptions.Date.Components

Localization options for YearMonthLocalizer and YearMonth.localize.

Link copied to clipboard
data class YearOptions(val eraStyle: EraStyle? = null, val yearStyle: YearStyle = YearStyle.NUMERIC) : ComponentsOptions.Date.Components

Localization options for YearLocalizer.

Link copied to clipboard
data class ZonedDateOptions

Localization options for ZonedLocalDateLocalizer.

Link copied to clipboard

Localizer for an Instant paired with a TimeZone (see Zoned).

actual class ZonedInstantLocalizer : PolyglotDateTimeZonedLocalizer<ERROR CLASS: Symbol not found for Instant>

Localizer for an Instant paired with a TimeZone (see Zoned).

Localizer for an Instant paired with a TimeZone (see Zoned).

Link copied to clipboard

Localization options for ZonedInstantLocalizer and Zoned.localize (where Zoned is of type Instant).

Link copied to clipboard

Localizer for Zoned<LocalDate>.

Link copied to clipboard
class ZonedYearLocalizer(options: ZonedYearOptions = ZonedYearOptions(), locale: PlatformLocale = getDefaultLocale()) : PolyglotDateTimeZonedLocalizer<Int>

Localizer for Zoned years (Zoned<Int>).

Link copied to clipboard
Link copied to clipboard
data class ZonedYearMonthOptions(val yearMonthOptions: YearMonthOptions, val timeZoneOptions: TimeZoneOptions = TimeZoneOptions())

Localization options for ZonedYearMonthLocalizer.

Link copied to clipboard
data class ZonedYearOptions(val yearOptions: YearOptions = YearOptions(), val timeZoneOptions: TimeZoneOptions = TimeZoneOptions())

Localization options for ZonedYearLocalizer.

Functions

Link copied to clipboard

Allows creation of mixed style and components between date and time, which is not possible in all platforms

Link copied to clipboard
fun Zoned<Instant>.localize(options: ZonedInstantOptions, locale: PlatformLocale = getDefaultLocale()): String

Localizes this Instant at this TimeZone with the given options in the given locale.

fun Zoned<LocalDate>.localize(options: ZonedDateOptions, locale: PlatformLocale = getDefaultLocale()): String
fun LocalDate.localize(options: DateStyleOptions, locale: PlatformLocale = getDefaultLocale()): String

Localizes this LocalDate with the given options in the given locale.

fun Zoned<YearMonth>.localize(options: ZonedYearMonthOptions, locale: PlatformLocale = getDefaultLocale()): String
fun YearMonth.localize(options: YearMonthOptions, locale: PlatformLocale = getDefaultLocale()): String

Localizes this YearMonth with the given options in the given locale.

fun Duration.localize(options: DurationOptions = DurationOptions(), locale: PlatformLocale = getDefaultLocale()): String

Localizes this Duration with the given options in the given locale.

fun LocalDateTime.localize(options: LocalDateTimeOptions, locale: PlatformLocale = getDefaultLocale()): String

Localizes this LocalDateTime with the given options in the given locale.

fun LocalTime.localize(options: LocalTimeOptions, locale: PlatformLocale = getDefaultLocale()): String
fun LocalTime.localize(options: TimeStyleOptions.Local, locale: PlatformLocale = getDefaultLocale()): String

Localizes this LocalTime with the given options in the given locale.

Link copied to clipboard
fun Instant.localizeDiff(options: TickingDurationOptions = TickingDurationOptions(), locale: PlatformLocale = getDefaultLocale(), clock: Clock = Clock.System): TickingValue<String>

Calculates the diff between this Instant and the current instnat of clock, and localizes the result with the given options in the given locale.

fun Instant.localizeDiff(reference: Instant, options: TickingDurationOptions = TickingDurationOptions(), locale: PlatformLocale = getDefaultLocale()): TickingValue<String>

Calculates the diff between this Instant and reference, and localizes the result with the given options in the given locale.

Link copied to clipboard
fun Instant.localizeDiffAsFlow(options: TickingDurationOptions = TickingDurationOptions(), locale: PlatformLocale = getDefaultLocale(), clock: Clock = Clock.System): Flow<String>

Calculates the diff between this Instant and clock, and localizes the result with the given options in the given locale, returning a Flow that automatically receives new localizations as they are needed.

Link copied to clipboard
fun Duration.localizeTicking(options: TickingDurationOptions = TickingDurationOptions(), locale: PlatformLocale = getDefaultLocale()): TickingValue<String>

Localizes this Duration with the given options in the given locale same as Duration.localize, but returns a TickingValue instead.