Closed
Description
TypeScript Version: 3.7.3
Search Terms: Intl.DateTimeFormat, DateTimeFormatOptions, date format types
Code
// A *self-contained* demonstration of the problem follows...
// Test this by running `tsc` on the command-line, rather than through another build tool such as Gulp,
(See below)
DateTimeFormatOptions interface missing specific types.
Lines 4253 to 4267 in 408b176
Expected behavior:
I would expect the types to match what's listed here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat
interface DateTimeFormatOptions {
localeMatcher?: 'lookup' | 'best fit';
weekday?: 'long' | 'short' | 'narrow';
era?: 'long' | 'short' | 'narrow';
year?: 'numeric' | '2-digit';
month?: 'numeric' | '2-digit' | 'long' | 'short' | 'narrow';
day?: 'numeric' | '2-digit';
hour?: 'numeric' | '2-digit';
minute?: 'numeric' | '2-digit';
second?: 'numeric' | '2-digit';
timeZoneName?: 'long' | 'short';
formatMatcher?: 'basic' | 'best fit';
hour12?: boolean;
timeZone?: string; // this is more complicated than the others, not sure what I expect here
}
Actual behavior:
interface DateTimeFormatOptions {
localeMatcher?: string;
weekday?: string;
era?: string;
year?: string;
month?: string;
day?: string;
hour?: string;
minute?: string;
second?: string;
timeZoneName?: string;
formatMatcher?: string;
hour12?: boolean;
timeZone?: string;
}
Playground Link:
Related Issues:
Couldn't find any