-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
In DiscussionNot yet reached consensusNot yet reached consensusSuggestionAn idea for TypeScriptAn idea for TypeScript
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
| 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; | |
| } |
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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
In DiscussionNot yet reached consensusNot yet reached consensusSuggestionAn idea for TypeScriptAn idea for TypeScript