@cellaware/utils 5.4.12 → 5.4.13
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/dist/azure/cosmos.js +35 -19
- package/package.json +1 -1
package/dist/azure/cosmos.js
CHANGED
|
@@ -6,28 +6,44 @@ const COSMOS_TIMESTAMP_DATETIME = `TimestampToDateTime(c._ts*1000)`;
|
|
|
6
6
|
* All Cosmos timestamps are UTC.
|
|
7
7
|
* https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
|
8
8
|
*/
|
|
9
|
+
const TIME_ZONE_OFFSETS = {
|
|
10
|
+
// North America:
|
|
11
|
+
'America/New_York': -5, 'America/New_York_DST': -4, // Eastern
|
|
12
|
+
'America/Chicago': -6, 'America/Chicago_DST': -5, // Central
|
|
13
|
+
'America/Denver': -7, 'America/Denver_DST': -6, // Mountain
|
|
14
|
+
'America/Phoenix': -7, // Mountain (no DST)
|
|
15
|
+
'America/Los_Angeles': -8, 'America/Los_Angeles_DST': -7, // Pacific
|
|
16
|
+
'America/Anchorage': -9, 'America/Anchorage_DST': -8, // Alaska
|
|
17
|
+
'Pacific/Honolulu': -10, // Hawaii (no DST)
|
|
18
|
+
// South America:
|
|
19
|
+
'America/Sao_Paulo': -3, // Brazil (DST mostly abolished)
|
|
20
|
+
'America/Buenos_Aires': -3, // Argentina
|
|
21
|
+
// Europe:
|
|
22
|
+
'Europe/London': 0, 'Europe/London_DST': 1, // UK
|
|
23
|
+
'Europe/Berlin': 1, 'Europe/Berlin_DST': 2, // Central Europe
|
|
24
|
+
'Europe/Moscow': 3, // Russia (no DST)
|
|
25
|
+
// Asia:
|
|
26
|
+
'Asia/Dubai': 4, // UAE
|
|
27
|
+
'Asia/Kolkata': 5.5, // India
|
|
28
|
+
'Asia/Shanghai': 8, // China
|
|
29
|
+
'Asia/Tokyo': 9, // Japan
|
|
30
|
+
'Asia/Singapore': 8,
|
|
31
|
+
// Australia:
|
|
32
|
+
'Australia/Sydney': 10, 'Australia/Sydney_DST': 11,
|
|
33
|
+
'Australia/Perth': 8,
|
|
34
|
+
// Africa:
|
|
35
|
+
'Africa/Johannesburg': 2,
|
|
36
|
+
'Africa/Lagos': 1
|
|
37
|
+
};
|
|
9
38
|
function getCosmosTimeZoneHourDiff(timeZone) {
|
|
10
39
|
let diff = 0;
|
|
11
40
|
if (!!timeZone) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
diff = dst ? -5 : -6;
|
|
19
|
-
break;
|
|
20
|
-
case 'America/Denver':
|
|
21
|
-
diff = dst ? -6 : -7;
|
|
22
|
-
break;
|
|
23
|
-
case 'America/Phoenix':
|
|
24
|
-
diff = -7;
|
|
25
|
-
break;
|
|
26
|
-
case 'America/Los_Angeles':
|
|
27
|
-
diff = dst ? -7 : -8;
|
|
28
|
-
break;
|
|
29
|
-
default:
|
|
30
|
-
break;
|
|
41
|
+
let lookupTimeZone = timeZone;
|
|
42
|
+
if (isDaylightSavingTime(timeZone)) {
|
|
43
|
+
lookupTimeZone += '_DST';
|
|
44
|
+
}
|
|
45
|
+
if (lookupTimeZone in TIME_ZONE_OFFSETS) {
|
|
46
|
+
diff = TIME_ZONE_OFFSETS[lookupTimeZone];
|
|
31
47
|
}
|
|
32
48
|
}
|
|
33
49
|
return diff;
|