@brightspace-ui/intl 3.33.0 → 3.33.1
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/lib/timeZones.js +9 -3
- package/package.json +1 -1
package/lib/timeZones.js
CHANGED
|
@@ -8,7 +8,13 @@ const tzMap = {
|
|
|
8
8
|
'Asia/Calcutta': 'Asia/Kolkata',
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
let timeZoneIdentifiers = null;
|
|
12
|
+
export function getTimeZoneIdentifiers() {
|
|
13
|
+
if (timeZoneIdentifiers === null) {
|
|
14
|
+
timeZoneIdentifiers = Intl.supportedValuesOf?.('timeZone').map(t => tzMap[t] || t) || [];
|
|
15
|
+
}
|
|
16
|
+
return timeZoneIdentifiers;
|
|
17
|
+
}
|
|
12
18
|
|
|
13
19
|
export async function getTimeZonesData(region, modules) {
|
|
14
20
|
let timeZones;
|
|
@@ -22,7 +28,7 @@ export async function getTimeZonesData(region, modules) {
|
|
|
22
28
|
}
|
|
23
29
|
} else {
|
|
24
30
|
if (timeZoneData) return timeZoneData;
|
|
25
|
-
timeZones =
|
|
31
|
+
timeZones = getTimeZoneIdentifiers();
|
|
26
32
|
}
|
|
27
33
|
return await Promise.all(timeZones.map(l => getTimeZoneData(l, { mapper })));
|
|
28
34
|
}
|
|
@@ -55,5 +61,5 @@ export async function getTimeZoneData(
|
|
|
55
61
|
}
|
|
56
62
|
|
|
57
63
|
export function validateTimeZone(identifier = getDocumentLocaleSettings().timezone.identifier) {
|
|
58
|
-
return
|
|
64
|
+
return getTimeZoneIdentifiers().includes(identifier);
|
|
59
65
|
}
|
package/package.json
CHANGED