@@ -6,10 +6,15 @@ declare namespace Intl {
66 * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DurationFormat/format#duration).
77 */
88 type DurationTimeFormatUnit = "years" | "months" | "weeks" | "days" | "hours" | "minutes" | "seconds" | "milliseconds" | "microseconds" | "nanoseconds"
9-
9+
10+ /**
11+ * The style of the formatted duration.
12+ *
13+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DurationFormat/DurationFormat#style).
14+ */
1015 type DurationFormatStyle = "long" | "short" | "narrow" | "digital"
1116
12-
17+
1318 type DurationFormatUnitSingular =
1419 | "year"
1520 | "quarter"
@@ -24,7 +29,7 @@ declare namespace Intl {
2429 * An object representing the relative time format in parts
2530 * that can be used for custom locale-aware formatting.
2631 *
27- * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat /formatToParts#Using_formatToParts ).
32+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DurationFormat /formatToParts#examples ).
2833 */
2934 type DurationFormatPart =
3035 | {
@@ -37,58 +42,72 @@ declare namespace Intl {
3742 unit : DurationFormatUnitSingular ;
3843 } ;
3944
40- type ResolvedDurationFormatOptions = {
41- locale : UnicodeBCP47LocaleIdentifier
42- numberingSystem : DateTimeFormatOptions [ "numberingSystem" ]
43- style : DurationFormatStyle
44- years : "long" | "short" | "narrow" ;
45- yearsDisplay :"always" | "auto" ;
46- months :"long" | "short" | "narrow" ;
47- monthsDisplay :"always" | "auto" ;
48- weeks :"long" | "short" | "narrow" ;
49- weeksDisplay :"always" | "auto" ;
50- days :"long" | "short" | "narrow" ;
51- daysDisplay :"always" | "auto" ;
52- hours :"long" | "short" | "narrow" | "numeric" | "2-digit"
53- hoursDisplay :"always" | "auto" ;
54- minutes :"long" | "short" | "narrow" | "numeric" | "2-digit"
55- minutesDisplay :"always" | "auto" ;
56- seconds :"long" | "short" | "narrow" | "numeric" | "2-digit"
57- secondsDisplay :"always" | "auto" ;
58- milliseconds :"long" | "short" | "narrow" | "numeric" | "2-digit"
59- millisecondsDisplay :"always" | "auto" ;
60- microseconds :"long" | "short" | "narrow" | "numeric" | "2-digit"
61- microsecondsDisplay :"always" | "auto" ;
62- nanosecond :"long" | "short" | "narrow" | "numeric" | "2-digit"
63- nanosecondDisplay :"always" | "auto" ;
64- fractionalDigits :0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
45+
46+
47+ type DurationFormatOptions = "long" | "short" | "narrow" | "numeric" | "2-digit"
48+
49+
50+ type DurationFormatDisplayOption = "always" | "auto" ;
51+
52+ /**
53+ * Number of how many fractional second digits to display in the output.
54+ *
55+ * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DurationFormat/DurationFormat#fractionaldigits).
56+ */
57+ type fractionalDigitsOption = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
58+
59+ interface ResolvedDurationFormatOptions {
60+ locale ?: UnicodeBCP47LocaleIdentifier
61+ numberingSystem ?: DateTimeFormatOptions [ "numberingSystem" ]
62+ style ?: DurationFormatStyle
63+ years ?: Omit < DurationFormatOptions , "numeric" | "2-digit" >
64+ yearsDisplay ?:DurationFormatDisplayOption
65+ months ?: Omit < DurationFormatOptions , "numeric" | "2-digit" >
66+ monthsDisplay ?: DurationFormatDisplayOption
67+ weeks ?: Omit < DurationFormatOptions , "numeric" | "2-digit" >
68+ weeksDisplay ?: DurationFormatDisplayOption
69+ days ?: Omit < DurationFormatOptions , "numeric" | "2-digit" >
70+ daysDisplay ?: DurationFormatDisplayOption
71+ hours ?: DurationFormatOptions
72+ hoursDisplay ?: DurationFormatDisplayOption
73+ minutes ?: DurationFormatOptions
74+ minutesDisplay ?: DurationFormatDisplayOption
75+ seconds ?: DurationFormatOptions
76+ secondsDisplay ?: DurationFormatDisplayOption
77+ milliseconds ?: DurationFormatOptions
78+ millisecondsDisplay ?: DurationFormatDisplayOption
79+ microseconds ?: DurationFormatOptions
80+ microsecondsDisplay ?: DurationFormatDisplayOption
81+ nanosecond ?: DurationFormatOptions
82+ nanosecondDisplay ?: DurationFormatDisplayOption
83+ fractionalDigits ?: fractionalDigitsOption
6584 }
6685
67- type DurationFormatOptions = {
68- localeMatcher : LocaleMatcher
69- numberingSystem : DateTimeFormatOptions [ "numberingSystem" ]
70- style : DurationFormatStyle
71- years : "long "| "short" | "narrow" ;
72- yearsDisplay : "always" | "auto" ;
73- months : "long "| "short" | "narrow" ;
74- monthsDisplay : "always" | "auto" ;
75- weeks : "long "| "short" | "narrow" ;
76- weeksDisplay : "always" | "auto" ;
77- days : "long "| "short" | "narrow" ;
78- daysDisplay : "always" | "auto" ;
79- hours : "long" | "short" | "narrow" | "numeric" | "2-digit"
80- hoursDisplay : "always" | "auto" ;
81- minutes : "long" | "short" | "narrow" | "numeric" | "2-digit"
82- minutesDisplay : "always" | "auto" ;
83- seconds : "long" | "short" | "narrow" | "numeric" | "2-digit"
84- secondsDisplay : "always" | "auto" ;
85- milliseconds : "long" | "short" | "narrow" | "numeric" | "2-digit"
86- millisecondsDisplay : "always" | "auto" ;
87- microseconds : "long" | "short" | "narrow" | "numeric" | "2-digit"
88- microsecondsDisplay : "always" | "auto" ;
89- nanosecond : "long" | "short" | "narrow" | "numeric" | "2-digit"
90- nanosecondDisplay : "always" | "auto" ;
91- fractionalDigits : 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
86+ interface DurationFormatOptions {
87+ localeMatcher ? : LocaleMatcher
88+ numberingSystem ? : DateTimeFormatOptions [ "numberingSystem" ]
89+ style ? : DurationFormatStyle
90+ years ?: Omit < DurationFormatOptions , "numeric "| "2-digit" >
91+ yearsDisplay ?: DurationFormatDisplayOption
92+ months ?: Omit < DurationFormatOptions , "numeric "| "2-digit" >
93+ monthsDisplay ?: DurationFormatDisplayOption
94+ weeks ?: Omit < DurationFormatOptions , "numeric "| "2-digit" >
95+ weeksDisplay ?: DurationFormatDisplayOption
96+ days ?: Omit < DurationFormatOptions , "numeric "| "2-digit" >
97+ daysDisplay ?: DurationFormatDisplayOption
98+ hours ?: DurationFormatOptions
99+ hoursDisplay ?: DurationFormatDisplayOption
100+ minutes ?: DurationFormatOptions
101+ minutesDisplay ?: DurationFormatDisplayOption
102+ seconds ?: DurationFormatOptions
103+ secondsDisplay ?: DurationFormatDisplayOption
104+ milliseconds ?: DurationFormatOptions
105+ millisecondsDisplay ?: DurationFormatDisplayOption
106+ microseconds ?: DurationFormatOptions
107+ microsecondsDisplay ?: DurationFormatDisplayOption
108+ nanosecond ?: DurationFormatOptions
109+ nanosecondDisplay ?: DurationFormatDisplayOption
110+ fractionalDigits ?: fractionalDigitsOption
92111 }
93112
94113 /**
@@ -110,7 +129,7 @@ declare namespace Intl {
110129 *
111130 * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DurationFormat/formatToParts).
112131 */
113- formatToParts ( duration : DurationType ) : DurationFormatPart ;
132+ formatToParts ( duration : DurationType ) : DurationFormatPart [ ] ;
114133 /**
115134 * [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl/DurationFormat/resolvedOptions).
116135 */
@@ -129,7 +148,7 @@ declare namespace Intl {
129148 *
130149 * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DurationFormat/DurationFormat).
131150 */
132- new ( locales : LocalesArgument , options : DurationFormatOptions ) : DisplayNames ;
151+ new ( locales : LocalesArgument , options : DurationFormatOptions ) : DurationFormat ;
133152
134153 /**
135154 * Returns an array containing those of the provided locales that are supported in display names without having to fall back to the runtime's default locale.
0 commit comments