@dative-gpi/foundation-shared-services 1.0.126 → 1.0.128
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.
|
@@ -37,15 +37,15 @@ export const useAppTimeZone = () => {
|
|
|
37
37
|
return (parseInt(hours) * 60 + parseInt(minutes)) * 60 * 1000;
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
const getMachineOffsetName = (): string => {
|
|
40
|
+
const getMachineOffsetName = (epoch: number | null = null): string => {
|
|
41
41
|
const formatter = getMachineFormatter();
|
|
42
|
-
const
|
|
43
|
-
const timeZoneName =
|
|
42
|
+
const date = formatter.formatToParts(epoch ? new Date(epoch) : new Date());
|
|
43
|
+
const timeZoneName = date.find((part) => part.type === "timeZoneName")?.value || "UTC+00:00";
|
|
44
44
|
return timeZoneName;
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
const getMachineOffset = (): number => {
|
|
48
|
-
const timeZoneName = getMachineOffsetName();
|
|
47
|
+
const getMachineOffset = (epoch: number | null = null): number => {
|
|
48
|
+
const timeZoneName = getMachineOffsetName(epoch);
|
|
49
49
|
const [hours, minutes] = timeZoneName.slice(3).split(':');
|
|
50
50
|
if (isNaN(parseInt(hours)) || isNaN(parseInt(minutes))) {
|
|
51
51
|
return 0;
|
|
@@ -174,7 +174,8 @@ export const useDateFormat = () => {
|
|
|
174
174
|
};
|
|
175
175
|
|
|
176
176
|
const yesterdayToPicker = (): string => {
|
|
177
|
-
const
|
|
177
|
+
const yesterday = subDays(new Date(), 1);
|
|
178
|
+
const date = addMilliseconds(yesterday, -getMachineOffset(yesterday.getTime()));
|
|
178
179
|
date.setSeconds(0, 0);
|
|
179
180
|
return format(date, ISO_FORMAT);
|
|
180
181
|
};
|
|
@@ -187,9 +188,9 @@ export const useDateFormat = () => {
|
|
|
187
188
|
return date.getTime();
|
|
188
189
|
};
|
|
189
190
|
|
|
190
|
-
const epochToISO = (
|
|
191
|
-
if (
|
|
192
|
-
return format(
|
|
191
|
+
const epochToISO = (epoch: number | null): string => {
|
|
192
|
+
if (epoch != null) {
|
|
193
|
+
return format(epoch - getMachineOffset(epoch), ISO_FORMAT);
|
|
193
194
|
}
|
|
194
195
|
return "";
|
|
195
196
|
};
|
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.128",
|
|
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.128"
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
16
|
"@dative-gpi/bones-ui": "^1.0.0",
|
|
@@ -18,5 +18,5 @@
|
|
|
18
18
|
"vue": "^3.4.38",
|
|
19
19
|
"vue-router": "^4.3.0"
|
|
20
20
|
},
|
|
21
|
-
"gitHead": "
|
|
21
|
+
"gitHead": "ca2de0b5abd0fb4f1fdfaafbc4267182ab609336"
|
|
22
22
|
}
|