@dative-gpi/foundation-shared-services 1.0.101 → 1.0.103
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.
|
@@ -21,17 +21,19 @@ export const useAppTimeZone = () => {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
const getUserOffsetName = (): string => {
|
|
24
|
+
const getUserOffsetName = (epoch: number | null = null): string => {
|
|
25
25
|
const formatter = getUserFormatter();
|
|
26
|
-
const
|
|
27
|
-
const timeZoneName =
|
|
26
|
+
const date = formatter.formatToParts(epoch ? new Date(epoch) : new Date());
|
|
27
|
+
const timeZoneName = date.find((part) => part.type === "timeZoneName")?.value || "UTC+00:00";
|
|
28
28
|
return timeZoneName
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
const getUserOffset = (): number => {
|
|
32
|
-
const timeZoneName = getUserOffsetName();
|
|
31
|
+
const getUserOffset = (epoch: number | null = null): number => {
|
|
32
|
+
const timeZoneName = getUserOffsetName(epoch);
|
|
33
33
|
const [hours, minutes] = timeZoneName.slice(3).split(':');
|
|
34
|
-
|
|
34
|
+
if (isNaN(parseInt(hours)) || isNaN(parseInt(minutes))) {
|
|
35
|
+
return 0;
|
|
36
|
+
}
|
|
35
37
|
return (parseInt(hours) * 60 + parseInt(minutes)) * 60 * 1000;
|
|
36
38
|
};
|
|
37
39
|
|
|
@@ -45,7 +47,9 @@ export const useAppTimeZone = () => {
|
|
|
45
47
|
const getMachineOffset = (): number => {
|
|
46
48
|
const timeZoneName = getMachineOffsetName();
|
|
47
49
|
const [hours, minutes] = timeZoneName.slice(3).split(':');
|
|
48
|
-
|
|
50
|
+
if (isNaN(parseInt(hours)) || isNaN(parseInt(minutes))) {
|
|
51
|
+
return 0;
|
|
52
|
+
}
|
|
49
53
|
return (parseInt(hours) * 60 + parseInt(minutes)) * 60 * 1000;
|
|
50
54
|
}
|
|
51
55
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dative-gpi/foundation-shared-services",
|
|
3
3
|
"sideEffects": false,
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.103",
|
|
5
5
|
"description": "",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"author": "",
|
|
11
11
|
"license": "ISC",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@dative-gpi/foundation-shared-domain": "1.0.
|
|
13
|
+
"@dative-gpi/foundation-shared-domain": "1.0.103"
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
16
|
"@dative-gpi/bones-ui": "^1.0.0",
|
|
@@ -18,5 +18,5 @@
|
|
|
18
18
|
"vue": "^3.4.29",
|
|
19
19
|
"vue-router": "^4.3.0"
|
|
20
20
|
},
|
|
21
|
-
"gitHead": "
|
|
21
|
+
"gitHead": "10dc8024a356f5b5a04a04aeeaf8fbf0f76a3c75"
|
|
22
22
|
}
|