@formatjs/intl-durationformat 0.9.0 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/package.json +3 -3
- package/polyfill-force.js +9 -17
- package/polyfill.js +10 -18
- package/should-polyfill.js +1 -1
- package/src/abstract/DurationRecordSign.d.ts +1 -1
- package/src/abstract/DurationRecordSign.js +11 -11
- package/src/abstract/GetDurationUnitOptions.d.ts +2 -2
- package/src/abstract/GetDurationUnitOptions.js +34 -41
- package/src/abstract/IsValidDurationRecord.d.ts +1 -1
- package/src/abstract/IsValidDurationRecord.js +16 -16
- package/src/abstract/PartitionDurationFormatPattern.d.ts +2 -2
- package/src/abstract/PartitionDurationFormatPattern.js +127 -147
- package/src/abstract/ToDurationRecord.d.ts +1 -1
- package/src/abstract/ToDurationRecord.js +58 -66
- package/src/abstract/ToIntegerIfIntegral.js +4 -4
- package/src/constants.d.ts +60 -60
- package/src/constants.js +83 -82
- package/src/core.d.ts +15 -15
- package/src/core.js +298 -247
- package/src/get_internal_slots.d.ts +3 -1
- package/src/get_internal_slots.js +7 -7
- package/src/numbering-systems.generated.js +99 -1
- package/src/time-separators.generated.d.ts +2342 -2340
- package/src/time-separators.generated.js +809 -3905
- package/src/types.d.ts +91 -89
- package/src/types.js +0 -1
package/src/types.d.ts
CHANGED
|
@@ -1,108 +1,110 @@
|
|
|
1
|
+
// Public --------------------------------------------------------------------------------------------------------------
|
|
1
2
|
export type DurationFormatOptions = Partial<ResolvedDurationFormatOptions>;
|
|
2
3
|
export interface ResolvedDurationFormatOptions {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
4
|
+
localeMatcher: "best fit" | "lookup";
|
|
5
|
+
style: "long" | "short" | "narrow" | "digital";
|
|
6
|
+
years: "long" | "short" | "narrow";
|
|
7
|
+
yearsDisplay: "always" | "auto";
|
|
8
|
+
months: "long" | "short" | "narrow";
|
|
9
|
+
monthsDisplay: "always" | "auto";
|
|
10
|
+
weeks: "long" | "short" | "narrow";
|
|
11
|
+
weeksDisplay: "always" | "auto";
|
|
12
|
+
days: "long" | "short" | "narrow";
|
|
13
|
+
daysDisplay: "always" | "auto";
|
|
14
|
+
hours: "long" | "short" | "narrow" | "numeric" | "2-digit";
|
|
15
|
+
hoursDisplay: "always" | "auto";
|
|
16
|
+
minutes: "long" | "short" | "narrow" | "numeric" | "2-digit";
|
|
17
|
+
minutesDisplay: "always" | "auto";
|
|
18
|
+
seconds: "long" | "short" | "narrow" | "numeric" | "2-digit";
|
|
19
|
+
secondsDisplay: "always" | "auto";
|
|
20
|
+
milliseconds: "long" | "short" | "narrow" | "numeric";
|
|
21
|
+
millisecondsDisplay: "always" | "auto";
|
|
22
|
+
microseconds: "long" | "short" | "narrow" | "numeric";
|
|
23
|
+
microsecondsDisplay: "always" | "auto";
|
|
24
|
+
nanoseconds: "long" | "short" | "narrow" | "numeric";
|
|
25
|
+
nanosecondsDisplay: "always" | "auto";
|
|
26
|
+
fractionalDigits?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
|
|
27
|
+
numberingSystem: string;
|
|
28
|
+
round: boolean;
|
|
28
29
|
}
|
|
29
30
|
export interface DurationFormatPart {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
unit?: string;
|
|
32
|
+
type: unknown;
|
|
33
|
+
value: string;
|
|
33
34
|
}
|
|
34
35
|
export interface RawDurationLocaleData {
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
data: DurationFormatLocaleInternalData;
|
|
37
|
+
locale: string;
|
|
37
38
|
}
|
|
38
39
|
export interface DurationFormatLocaleInternalData {
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
// Bc of relevantExtensionKeys in the spec
|
|
41
|
+
nu: readonly string[];
|
|
42
|
+
digitalFormat: Record<string, string>;
|
|
41
43
|
}
|
|
42
44
|
export interface DurationFormat {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
resolvedOptions(): ResolvedDurationFormatOptions;
|
|
46
|
+
formatToParts(duration: DurationInput): DurationFormatPart[];
|
|
47
|
+
format(duration: DurationInput): string;
|
|
46
48
|
}
|
|
47
49
|
export interface IntlDurationFormatInternal {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
50
|
+
initializedDurationFormat: boolean;
|
|
51
|
+
fractionalDigits: number | undefined;
|
|
52
|
+
dataLocale: string;
|
|
53
|
+
locale: string;
|
|
54
|
+
numberingSystem: string;
|
|
55
|
+
style: DurationFormatOptions["style"];
|
|
56
|
+
years: "long" | "short" | "narrow";
|
|
57
|
+
yearsDisplay: "always" | "auto";
|
|
58
|
+
months: "long" | "short" | "narrow";
|
|
59
|
+
monthsDisplay: "always" | "auto";
|
|
60
|
+
weeks: "long" | "short" | "narrow";
|
|
61
|
+
weeksDisplay: "always" | "auto";
|
|
62
|
+
days: "long" | "short" | "narrow";
|
|
63
|
+
daysDisplay: "always" | "auto";
|
|
64
|
+
hours: "long" | "short" | "narrow" | "numeric" | "2-digit";
|
|
65
|
+
hoursDisplay: "always" | "auto";
|
|
66
|
+
minutes: "long" | "short" | "narrow" | "numeric" | "2-digit";
|
|
67
|
+
minutesDisplay: "always" | "auto";
|
|
68
|
+
seconds: "long" | "short" | "narrow" | "numeric" | "2-digit";
|
|
69
|
+
secondsDisplay: "always" | "auto";
|
|
70
|
+
milliseconds: "long" | "short" | "narrow" | "numeric";
|
|
71
|
+
millisecondsDisplay: "always" | "auto";
|
|
72
|
+
microseconds: "long" | "short" | "narrow" | "numeric";
|
|
73
|
+
microsecondsDisplay: "always" | "auto";
|
|
74
|
+
nanoseconds: "long" | "short" | "narrow" | "numeric";
|
|
75
|
+
nanosecondsDisplay: "always" | "auto";
|
|
74
76
|
}
|
|
75
77
|
export interface DurationInput {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
78
|
+
years?: number;
|
|
79
|
+
months?: number;
|
|
80
|
+
weeks?: number;
|
|
81
|
+
days?: number;
|
|
82
|
+
hours?: number;
|
|
83
|
+
minutes?: number;
|
|
84
|
+
seconds?: number;
|
|
85
|
+
milliseconds?: number;
|
|
86
|
+
microseconds?: number;
|
|
87
|
+
nanoseconds?: number;
|
|
86
88
|
}
|
|
87
89
|
export interface DurationRecord {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
90
|
+
years: number;
|
|
91
|
+
months: number;
|
|
92
|
+
weeks: number;
|
|
93
|
+
days: number;
|
|
94
|
+
hours: number;
|
|
95
|
+
minutes: number;
|
|
96
|
+
seconds: number;
|
|
97
|
+
milliseconds: number;
|
|
98
|
+
microseconds: number;
|
|
99
|
+
nanoseconds: number;
|
|
98
100
|
}
|
|
99
101
|
export interface DurationFormatConstructor {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
102
|
+
new (locales?: string | string[], options?: DurationFormatOptions): DurationFormat;
|
|
103
|
+
(locales?: string | string[], options?: DurationFormatOptions): DurationFormat;
|
|
104
|
+
supportedLocalesOf(locales: string | string[], options?: Pick<DurationFormatOptions, "localeMatcher">): string[];
|
|
105
|
+
getDefaultLocale(): string;
|
|
106
|
+
__defaultLocale: string;
|
|
107
|
+
localeData: Record<string, DurationFormatLocaleInternalData | undefined>;
|
|
108
|
+
availableLocales: Set<string>;
|
|
109
|
+
polyfilled: boolean;
|
|
108
110
|
}
|
package/src/types.js
CHANGED