RelativeTimeFormat
t
RESCRIPT
type t
numeric
RESCRIPT
type numeric = [#always | #auto]
style
RESCRIPT
type style = [#long | #narrow | #short]
timeUnit
RESCRIPT
type timeUnit = [
| #day
| #hour
| #minute
| #month
| #quarter
| #second
| #week
| #year
]
options
RESCRIPT
type options = {
localeMatcher?: Intl_Common.localeMatcher,
numeric?: numeric,
style?: style,
}
supportedLocalesOptions
RESCRIPT
type supportedLocalesOptions = {
localeMatcher: Intl_Common.localeMatcher,
}
resolvedOptions
RESCRIPT
type resolvedOptions = {
locale: string,
numeric: numeric,
style: style,
numberingSystem: string,
}
relativeTimePartComponent
RESCRIPT
type relativeTimePartComponent = [#integer | #literal]
relativeTimePart
RESCRIPT
type relativeTimePart = {
\"type": relativeTimePartComponent,
value: string,
unit?: timeUnit,
}
make
RESCRIPT
let make: (~locales: array<string>=?, ~options: options=?) => t
supportedLocalesOf
RESCRIPT
let supportedLocalesOf: (array<string>, ~options: supportedLocalesOptions=?) => t
resolvedOptions
RESCRIPT
let resolvedOptions: t => resolvedOptions
format
RESCRIPT
let format: (t, int, timeUnit) => string
formatToParts
RESCRIPT
let formatToParts: (t, int, timeUnit) => array<relativeTimePart>
ignore
RESCRIPT
let ignore: t => unit
ignore(relativeTimeFormat)
ignores the provided relativeTimeFormat and returns unit.
This helper is useful when you want to discard a value (for example, the result of an operation with side effects) without having to store or process it further.