DateTimeFormat
t
RESCRIPT
type t
dateStyle
RESCRIPT
type dateStyle = [#full | #long | #medium | #short]
timeStyle
RESCRIPT
type timeStyle = [#full | #long | #medium | #short]
dayPeriod
RESCRIPT
type dayPeriod = [#long | #narrow | #short]
weekday
RESCRIPT
type weekday = [#long | #narrow | #short]
era
RESCRIPT
type era = [#long | #narrow | #short]
year
RESCRIPT
type year = [#"2-digit" | #numeric]
month
RESCRIPT
type month = [
| #"2-digit"
| #long
| #narrow
| #numeric
| #short
]
day
RESCRIPT
type day = [#"2-digit" | #numeric]
hour
RESCRIPT
type hour = [#"2-digit" | #numeric]
minute
RESCRIPT
type minute = [#"2-digit" | #numeric]
second
RESCRIPT
type second = [#"2-digit" | #numeric]
timeZoneName
RESCRIPT
type timeZoneName = [
| #long
| #longGeneric
| #longOffset
| #short
| #shortGeneric
| #shortOffset
]
Firefox also supports IANA time zone names here Node v19+ supports "shortOffset", "shortGeneric", "longOffset", and "longGeneric".
hourCycle
RESCRIPT
type hourCycle = [#h11 | #h12 | #h23 | #h24]
formatMatcher
RESCRIPT
type formatMatcher = [#basic | #bestFit]
fractionalSecondDigits
RESCRIPT
type fractionalSecondDigits = [#0 | #1 | #2 | #3]
options
RESCRIPT
type options = {
dateStyle?: dateStyle,
timeStyle?: timeStyle,
calendar?: Core__Intl__Common.calendar,
dayPeriod?: dayPeriod,
numberingSystem?: Core__Intl__Common.numberingSystem,
localeMatcher?: Core__Intl__Common.localeMatcher,
timeZone?: string,
hour12?: bool,
hourCycle?: hourCycle,
formatMatcher?: formatMatcher,
weekday?: weekday,
era?: era,
year?: year,
month?: month,
day?: day,
hour?: hour,
minute?: minute,
second?: second,
fractionalSecondDigits?: fractionalSecondDigits,
timeZoneName?: timeZoneName,
}
resolvedOptions
RESCRIPT
type resolvedOptions = {
dateStyle?: dateStyle,
timeStyle?: timeStyle,
weekday?: weekday,
era?: era,
year?: year,
month?: month,
day?: day,
hour?: hour,
minute?: minute,
second?: second,
fractionalSecondDigits?: fractionalSecondDigits,
timeZoneName?: timeZoneName,
calendar: Core__Intl__Common.calendar,
hour12: bool,
hourCycle: hourCycle,
locale: string,
numberingSystem: Core__Intl__Common.numberingSystem,
timeZone: string,
}
supportedLocalesOptions
RESCRIPT
type supportedLocalesOptions = {
localeMatcher: Core__Intl__Common.localeMatcher,
}
dateTimeComponent
RESCRIPT
type dateTimeComponent = [
| #day
| #dayPeriod
| #era
| #fractionalSecond
| #hour
| #literal
| #minute
| #month
| #relatedYear
| #second
| #timeZone
| #weekday
| #year
| #yearName
]
dateTimePart
RESCRIPT
type dateTimePart = {
\"type": dateTimeComponent,
value: string,
}
dateTimeRangeSource
RESCRIPT
type dateTimeRangeSource = [
| #endRange
| #shared
| #startRange
]
dateTimeRangePart
RESCRIPT
type dateTimeRangePart = {
\"type": dateTimeComponent,
value: string,
source: dateTimeRangeSource,
}
make
RESCRIPT
let make: unit => t
makeWithLocale
RESCRIPT
let makeWithLocale: string => t
makeWithLocales
RESCRIPT
let makeWithLocales: array<string> => t
makeWithLocaleAndOptions
RESCRIPT
let makeWithLocaleAndOptions: (string, options) => t
makeWithLocalesAndOptions
RESCRIPT
let makeWithLocalesAndOptions: (array<string>, options) => t
makeWithOptions
RESCRIPT
let makeWithOptions: options => t
supportedLocalesOf
RESCRIPT
let supportedLocalesOf: array<string> => t
supportedLocalesOfWithOptions
RESCRIPT
let supportedLocalesOfWithOptions: (array<string>, supportedLocalesOptions) => t
resolvedOptions
RESCRIPT
let resolvedOptions: t => resolvedOptions
format
RESCRIPT
let format: (t, Core__Date.t) => string
formatToParts
RESCRIPT
let formatToParts: (
t,
Core__Date.t,
) => array<{"type": string, "value": string}>
formatRange
RESCRIPT
let formatRange: (
t,
~startDate: Core__Date.t,
~endDate: Core__Date.t,
) => string
formatRangeToParts
RESCRIPT
let formatRangeToParts: (
t,
~startDate: Core__Date.t,
~endDate: Core__Date.t,
) => array<
{"source": string, "type": string, "value": string},
>