@dative-gpi/foundation-shared-services 1.0.9 → 1.0.11

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.
@@ -79,6 +79,14 @@ export const useAppTimeZone = () => {
79
79
  return (parseInt(offsetParts[0]) * 60 + parseInt(offsetParts[1])) * 60 * 1000;
80
80
  };
81
81
 
82
+ const getOffsetUserChart = (withUTC: boolean = true): string => {
83
+ const offsetPart = (Intl.DateTimeFormat(undefined, {
84
+ timeZone: timeZone.value,
85
+ timeZoneName: "longOffset"
86
+ }).formatToParts(new Date).pop()?.value.slice(3) || "+00:00");
87
+ return `${withUTC ? 'UTC ' : ''}${offsetPart}`;
88
+ }
89
+
82
90
  const getOffsetMachine = (): number => {
83
91
  const offsetParts = (Intl.DateTimeFormat(undefined, {
84
92
  timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
@@ -87,6 +95,14 @@ export const useAppTimeZone = () => {
87
95
  return (parseInt(offsetParts[0]) * 60 + parseInt(offsetParts[1])) * 60 * 1000;
88
96
  };
89
97
 
98
+ const getOffsetMachineChart = (withUTC: boolean = true): string => {
99
+ const offsetPart = (Intl.DateTimeFormat(undefined, {
100
+ timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
101
+ timeZoneName: "longOffset"
102
+ }).formatToParts(new Date).pop()?.value.slice(3) || "+00:00");
103
+ return `${withUTC ? 'UTC ' : ''}${offsetPart}`;
104
+ }
105
+
90
106
  const getOffsetDifference = (): number => {
91
107
  if (timeZone.value == null) {
92
108
  return 0;
@@ -173,6 +189,8 @@ export const useAppTimeZone = () => {
173
189
  formatEpochToVariable,
174
190
  getOffsetUser,
175
191
  getOffsetMachine,
176
- getOffsetDifference
192
+ getOffsetDifference,
193
+ getOffsetUserChart,
194
+ getOffsetMachineChart
177
195
  };
178
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.9",
4
+ "version": "1.0.11",
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.9"
13
+ "@dative-gpi/foundation-shared-domain": "1.0.11"
14
14
  },
15
15
  "peerDependencies": {
16
16
  "@dative-gpi/bones-ui": "^0.0.75",
@@ -18,5 +18,5 @@
18
18
  "vue": "^3.4.29",
19
19
  "vue-router": "^4.3.0"
20
20
  },
21
- "gitHead": "018a67489fc022344c90d45b02bfabdcd0dcefec"
21
+ "gitHead": "09cb2eac9d07026646421d3d70214f4cdc5041f2"
22
22
  }