Description
lib Update Request
Configuration Check
My compilation target is ES2020
and my lib is the default
.
Missing / Incorrect Definition
Intl.ResolvedDateTimeFormatOptions
- the type returned by calling DateTimeFormat
's resolvedOptions
method - appears to be missing the following properties:
dateStyle
timeStyle
dayPeriod
hourCycle
fractionalSecondDigits
It looks like these items (along with calendar
and numberingSystem
) were added to es2020.intl.d.ts
's DateTimeFormatOptions
however they were never added to ResolvedDateTimeFormatOptions
.
It seems that calendar
and numberingSystem
are both present in es5.d.ts
's ResolvedDateTimeFormatOptions
. Because of this I am unsure if the absent options should be added to ResolvedDateTimeFormatOptions
in es5.d.ts or es2020.d.ts.
https://tc39.es/ecma402/#table-datetimeformat-resolvedoptions-properties is the spec table of possible returned properties
Sample Code
console.log(new Intl.DateTimeFormat('en-US', { dateStyle: 'short' }).resolvedOptions().dateStyle)
console.log(new Intl.DateTimeFormat('en-US', { timeStyle: 'long' }).resolvedOptions().timeStyle)
console.log(new Intl.DateTimeFormat('en-US', { dayPeriod: 'narrow' }).resolvedOptions().dayPeriod)
console.log(new Intl.DateTimeFormat('en-US', { timeStyle: 'long', hourCycle:'h24' }).resolvedOptions().hourCycle)
console.log(new Intl.DateTimeFormat('en-US', { fractionalSecondDigits: 1 }).resolvedOptions().fractionalSecondDigits)
The above lines throw type errors saying the various properies on resolvedOptions
do not exist
Documentation Link
https://tc39.es/ecma402/#table-datetimeformat-resolvedoptions-properties