Skip to content

Commit 9079a43

Browse files
committed
fix: fixes microsoft#35865 - document and flesh out legal Intl.DateTimeFormatOptions types
1 parent 5ef2228 commit 9079a43

File tree

1 file changed

+25
-11
lines changed

1 file changed

+25
-11
lines changed

lib/lib.es5.d.ts

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4297,20 +4297,34 @@ declare namespace Intl {
42974297
supportedLocalesOf(locales: string | string[], options?: NumberFormatOptions): string[];
42984298
};
42994299

4300+
type DateFormatNumericVerbosity = "numeric" | "2-digit";
4301+
type DateFormatNameVerbosity = "long" | "short" | "narrow";
4302+
43004303
interface DateTimeFormatOptions {
4301-
localeMatcher?: string;
4302-
weekday?: string;
4303-
era?: string;
4304-
year?: string;
4305-
month?: string;
4306-
day?: string;
4307-
hour?: string;
4308-
minute?: string;
4309-
second?: string;
4310-
timeZoneName?: string;
4311-
formatMatcher?: string;
4304+
/** output examples – numeric: "2020", 2-digit: "20" */
4305+
year?: DateFormatNumericVerbosity;
4306+
/** output examples – numeric: "3", 2-digit: "03", long: "March", short: "Mar", narrow: "M" */
4307+
month?: DateFormatNumericVerbosity | DateFormatNameVerbosity;
4308+
/** output examples – numeric: "2", 2-digit: "02" */
4309+
day?: DateFormatNumericVerbosity;
4310+
/** output examples – numeric: "2", 2-digit: "02" */
4311+
hour?: DateFormatNumericVerbosity;
4312+
/** output examples – numeric: "2", 2-digit: "02" */
4313+
minute?: DateFormatNumericVerbosity;
4314+
/** output examples – numeric: "2", 2-digit: "02" */
4315+
second?: DateFormatNumericVerbosity;
4316+
/** output examples – long: "Thursday", short: "Thu", narrow: "T" */
4317+
weekday?: DateFormatNameVerbosity;
4318+
/** output examples – long: "Anno Domini", short: "AD", narrow "A" */
4319+
era?: DateFormatNameVerbosity;
4320+
/** set to `true` to force 12-hour am/pm "dayPeriod" values, or `false` to force 24-hour time without */
43124321
hour12?: boolean;
4322+
/** output examples – long: "Pacific Daylight Time", short: "PDT" */
4323+
timeZoneName?: "long" | "short";
4324+
/** set to the timezone name you want to render date and time for, e g "UTC", "Europe/Rome" */
43134325
timeZone?: string;
4326+
localeMatcher?: "best fit" | "lookup";
4327+
formatMatcher?: "best fit" | "basic";
43144328
}
43154329

43164330
interface ResolvedDateTimeFormatOptions {

0 commit comments

Comments
 (0)