@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.
Files changed (2) hide show
  1. package/lib/timeZones.js +9 -3
  2. 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
- export const timeZoneIdentifiers = Intl.supportedValuesOf('timeZone').map(t => tzMap[t] || t);
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 = timeZoneIdentifiers;
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 timeZoneIdentifiers.includes(identifier);
64
+ return getTimeZoneIdentifiers().includes(identifier);
59
65
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/intl",
3
- "version": "3.33.0",
3
+ "version": "3.33.1",
4
4
  "description": "Internationalization APIs for number, date, time and file size formatting and parsing in D2L Brightspace.",
5
5
  "main": "lib/number.js",
6
6
  "type": "module",