@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/src/types.d.ts CHANGED
@@ -1,108 +1,110 @@
1
+ // Public --------------------------------------------------------------------------------------------------------------
1
2
  export type DurationFormatOptions = Partial<ResolvedDurationFormatOptions>;
2
3
  export interface ResolvedDurationFormatOptions {
3
- localeMatcher: 'best fit' | 'lookup';
4
- style: 'long' | 'short' | 'narrow' | 'digital';
5
- years: 'long' | 'short' | 'narrow';
6
- yearsDisplay: 'always' | 'auto';
7
- months: 'long' | 'short' | 'narrow';
8
- monthsDisplay: 'always' | 'auto';
9
- weeks: 'long' | 'short' | 'narrow';
10
- weeksDisplay: 'always' | 'auto';
11
- days: 'long' | 'short' | 'narrow';
12
- daysDisplay: 'always' | 'auto';
13
- hours: 'long' | 'short' | 'narrow' | 'numeric' | '2-digit';
14
- hoursDisplay: 'always' | 'auto';
15
- minutes: 'long' | 'short' | 'narrow' | 'numeric' | '2-digit';
16
- minutesDisplay: 'always' | 'auto';
17
- seconds: 'long' | 'short' | 'narrow' | 'numeric' | '2-digit';
18
- secondsDisplay: 'always' | 'auto';
19
- milliseconds: 'long' | 'short' | 'narrow' | 'numeric';
20
- millisecondsDisplay: 'always' | 'auto';
21
- microseconds: 'long' | 'short' | 'narrow' | 'numeric';
22
- microsecondsDisplay: 'always' | 'auto';
23
- nanoseconds: 'long' | 'short' | 'narrow' | 'numeric';
24
- nanosecondsDisplay: 'always' | 'auto';
25
- fractionalDigits?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
26
- numberingSystem: string;
27
- round: boolean;
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
- unit?: string;
31
- type: unknown;
32
- value: string;
31
+ unit?: string;
32
+ type: unknown;
33
+ value: string;
33
34
  }
34
35
  export interface RawDurationLocaleData {
35
- data: DurationFormatLocaleInternalData;
36
- locale: string;
36
+ data: DurationFormatLocaleInternalData;
37
+ locale: string;
37
38
  }
38
39
  export interface DurationFormatLocaleInternalData {
39
- nu: readonly string[];
40
- digitalFormat: Record<string, string>;
40
+ // Bc of relevantExtensionKeys in the spec
41
+ nu: readonly string[];
42
+ digitalFormat: Record<string, string>;
41
43
  }
42
44
  export interface DurationFormat {
43
- resolvedOptions(): ResolvedDurationFormatOptions;
44
- formatToParts(duration: DurationInput): DurationFormatPart[];
45
- format(duration: DurationInput): string;
45
+ resolvedOptions(): ResolvedDurationFormatOptions;
46
+ formatToParts(duration: DurationInput): DurationFormatPart[];
47
+ format(duration: DurationInput): string;
46
48
  }
47
49
  export interface IntlDurationFormatInternal {
48
- initializedDurationFormat: boolean;
49
- fractionalDigits: number | undefined;
50
- dataLocale: string;
51
- locale: string;
52
- numberingSystem: string;
53
- style: DurationFormatOptions['style'];
54
- years: 'long' | 'short' | 'narrow';
55
- yearsDisplay: 'always' | 'auto';
56
- months: 'long' | 'short' | 'narrow';
57
- monthsDisplay: 'always' | 'auto';
58
- weeks: 'long' | 'short' | 'narrow';
59
- weeksDisplay: 'always' | 'auto';
60
- days: 'long' | 'short' | 'narrow';
61
- daysDisplay: 'always' | 'auto';
62
- hours: 'long' | 'short' | 'narrow' | 'numeric' | '2-digit';
63
- hoursDisplay: 'always' | 'auto';
64
- minutes: 'long' | 'short' | 'narrow' | 'numeric' | '2-digit';
65
- minutesDisplay: 'always' | 'auto';
66
- seconds: 'long' | 'short' | 'narrow' | 'numeric' | '2-digit';
67
- secondsDisplay: 'always' | 'auto';
68
- milliseconds: 'long' | 'short' | 'narrow' | 'numeric';
69
- millisecondsDisplay: 'always' | 'auto';
70
- microseconds: 'long' | 'short' | 'narrow' | 'numeric';
71
- microsecondsDisplay: 'always' | 'auto';
72
- nanoseconds: 'long' | 'short' | 'narrow' | 'numeric';
73
- nanosecondsDisplay: 'always' | 'auto';
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
- years?: number;
77
- months?: number;
78
- weeks?: number;
79
- days?: number;
80
- hours?: number;
81
- minutes?: number;
82
- seconds?: number;
83
- milliseconds?: number;
84
- microseconds?: number;
85
- nanoseconds?: number;
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
- years: number;
89
- months: number;
90
- weeks: number;
91
- days: number;
92
- hours: number;
93
- minutes: number;
94
- seconds: number;
95
- milliseconds: number;
96
- microseconds: number;
97
- nanoseconds: number;
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
- new (locales?: string | string[], options?: DurationFormatOptions): DurationFormat;
101
- (locales?: string | string[], options?: DurationFormatOptions): DurationFormat;
102
- supportedLocalesOf(locales: string | string[], options?: Pick<DurationFormatOptions, 'localeMatcher'>): string[];
103
- getDefaultLocale(): string;
104
- __defaultLocale: string;
105
- localeData: Record<string, DurationFormatLocaleInternalData | undefined>;
106
- availableLocales: Set<string>;
107
- polyfilled: boolean;
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
@@ -1,2 +1 @@
1
- // Public --------------------------------------------------------------------------------------------------------------
2
1
  export {};