@dative-gpi/foundation-shared-services 0.0.50 → 0.0.51
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { computed, ref
|
|
1
|
+
import { computed, ref } from "vue";
|
|
2
2
|
|
|
3
|
-
const languageCode = ref<string |
|
|
3
|
+
const languageCode = ref<string | undefined>(undefined);
|
|
4
4
|
|
|
5
5
|
export const useAppLanguageCode = () => {
|
|
6
6
|
const setLanguageCode = (payload: string) => {
|
|
@@ -73,25 +73,32 @@ export const useAppTimeZone = () => {
|
|
|
73
73
|
return today.getTime() + getMachineOffsetMillis() - getUserOffsetMillis();
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
const pickerToEpoch = (value: Date): number => {
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
const pickerToEpoch = (value: Date | null | undefined): number => {
|
|
77
|
+
if (value != null) {
|
|
78
|
+
// FSCalendar is always in machine time zone, so we need to convert it to user time zone
|
|
79
|
+
return value.getTime() + getMachineOffsetMillis() - getUserOffsetMillis();
|
|
80
|
+
}
|
|
81
|
+
return 0;
|
|
79
82
|
};
|
|
80
83
|
|
|
81
|
-
const epochToPicker = (value: number): Date => {
|
|
82
|
-
// Epoch is always without time zone, so we need to convert it to user time zone
|
|
84
|
+
const epochToPicker = (value: number | null | undefined): Date => {
|
|
83
85
|
const date = new Date(0);
|
|
84
|
-
|
|
86
|
+
if (value != null) {
|
|
87
|
+
// Epoch is always without time zone, so we need to convert it to user time zone
|
|
88
|
+
date.setUTCMilliseconds(value - getMachineOffsetMillis() + getUserOffsetMillis());
|
|
89
|
+
}
|
|
85
90
|
return date;
|
|
86
91
|
};
|
|
87
92
|
|
|
88
93
|
const epochToPickerHeader = (value: number): { d: number, m: number, y: number } => {
|
|
89
94
|
const date = new Date(0);
|
|
90
|
-
|
|
95
|
+
if (value != null) {
|
|
96
|
+
date.setUTCMilliseconds(value - getMachineOffsetMillis() + getUserOffsetMillis());
|
|
97
|
+
}
|
|
91
98
|
return { d: date.getDate(), m: date.getMonth(), y: date.getFullYear() };
|
|
92
99
|
};
|
|
93
100
|
|
|
94
|
-
const epochToLongDateFormat = (value: number): string => {
|
|
101
|
+
const epochToLongDateFormat = (value: number | null | undefined): string => {
|
|
95
102
|
if (value == null || !isFinite(value)) {
|
|
96
103
|
return "";
|
|
97
104
|
}
|
|
@@ -100,7 +107,7 @@ export const useAppTimeZone = () => {
|
|
|
100
107
|
return format(date, "EEEE dd LLLL yyyy", { locale: getLocale() });
|
|
101
108
|
};
|
|
102
109
|
|
|
103
|
-
const epochToLongTimeFormat = (value: number): string => {
|
|
110
|
+
const epochToLongTimeFormat = (value: number | null | undefined): string => {
|
|
104
111
|
if (value == null || !isFinite(value)) {
|
|
105
112
|
return "";
|
|
106
113
|
}
|
|
@@ -109,7 +116,7 @@ export const useAppTimeZone = () => {
|
|
|
109
116
|
return format(date, overrideFormat(date, "EEEE dd LLLL yyyy HH:mm"), { locale: getLocale() })
|
|
110
117
|
};
|
|
111
118
|
|
|
112
|
-
const epochToShortDateFormat = (value: number): string => {
|
|
119
|
+
const epochToShortDateFormat = (value: number | null | undefined): string => {
|
|
113
120
|
if (value == null || !isFinite(value)) {
|
|
114
121
|
return "";
|
|
115
122
|
}
|
|
@@ -125,7 +132,7 @@ export const useAppTimeZone = () => {
|
|
|
125
132
|
}
|
|
126
133
|
};
|
|
127
134
|
|
|
128
|
-
const epochToShortTimeFormat = (value: number): string => {
|
|
135
|
+
const epochToShortTimeFormat = (value: number | null | undefined): string => {
|
|
129
136
|
if (value == null || !isFinite(value)) {
|
|
130
137
|
return "";
|
|
131
138
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dative-gpi/foundation-shared-services",
|
|
3
3
|
"sideEffects": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.51",
|
|
5
5
|
"description": "",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
"license": "ISC",
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@dative-gpi/bones-ui": "^0.0.61",
|
|
14
|
-
"@dative-gpi/foundation-shared-domain": "0.0.
|
|
14
|
+
"@dative-gpi/foundation-shared-domain": "0.0.51",
|
|
15
15
|
"@microsoft/signalr": "^8.0.0",
|
|
16
16
|
"vue": "^3.2.0",
|
|
17
17
|
"vue-router": "^4.2.5"
|
|
18
18
|
},
|
|
19
|
-
"gitHead": "
|
|
19
|
+
"gitHead": "13a8e0d4bd10a05a35c570412fa2024d33b0c115"
|
|
20
20
|
}
|