@trackunit/react-date-and-time-hooks 2.1.8 → 2.1.9
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/index.cjs.js +6 -0
- package/index.esm.js +6 -0
- package/package.json +6 -6
package/index.cjs.js
CHANGED
|
@@ -34,6 +34,8 @@ const BrowserLocale = navigator.language ?? "en";
|
|
|
34
34
|
* @returns {string} The current locale.
|
|
35
35
|
*/
|
|
36
36
|
const useLocale = () => {
|
|
37
|
+
// TODO: migrate to useLocalStorage hook — this file was exempted when the no-direct-storage-access rule was introduced
|
|
38
|
+
// eslint-disable-next-line no-restricted-globals
|
|
37
39
|
const savedLanguage = localStorage.getItem(LANG_STORAGE_KEY);
|
|
38
40
|
const selectedLanguage = savedLanguage || BrowserLocale || "en";
|
|
39
41
|
const userLocale = convertToLocale(selectedLanguage);
|
|
@@ -43,6 +45,8 @@ const useLocale = () => {
|
|
|
43
45
|
const CUSTOM_TIMEZONE_KEY = "customTimeZone";
|
|
44
46
|
const readTimezoneFromStorage = () => {
|
|
45
47
|
try {
|
|
48
|
+
// TODO: migrate to useLocalStorage hook — this file was exempted when the no-direct-storage-access rule was introduced
|
|
49
|
+
// eslint-disable-next-line no-restricted-globals
|
|
46
50
|
const raw = localStorage.getItem(CUSTOM_TIMEZONE_KEY);
|
|
47
51
|
if (raw === null)
|
|
48
52
|
return null;
|
|
@@ -87,9 +91,11 @@ const useTimezone = () => {
|
|
|
87
91
|
const setCustomTimezone = react.useCallback((timezone) => {
|
|
88
92
|
setLocalStorageCustomTimezone(timezone);
|
|
89
93
|
if (timezone === null) {
|
|
94
|
+
// eslint-disable-next-line no-restricted-globals
|
|
90
95
|
localStorage.removeItem(CUSTOM_TIMEZONE_KEY);
|
|
91
96
|
}
|
|
92
97
|
else {
|
|
98
|
+
// eslint-disable-next-line no-restricted-globals
|
|
93
99
|
localStorage.setItem(CUSTOM_TIMEZONE_KEY, JSON.stringify(timezone));
|
|
94
100
|
}
|
|
95
101
|
}, []);
|
package/index.esm.js
CHANGED
|
@@ -32,6 +32,8 @@ const BrowserLocale = navigator.language ?? "en";
|
|
|
32
32
|
* @returns {string} The current locale.
|
|
33
33
|
*/
|
|
34
34
|
const useLocale = () => {
|
|
35
|
+
// TODO: migrate to useLocalStorage hook — this file was exempted when the no-direct-storage-access rule was introduced
|
|
36
|
+
// eslint-disable-next-line no-restricted-globals
|
|
35
37
|
const savedLanguage = localStorage.getItem(LANG_STORAGE_KEY);
|
|
36
38
|
const selectedLanguage = savedLanguage || BrowserLocale || "en";
|
|
37
39
|
const userLocale = convertToLocale(selectedLanguage);
|
|
@@ -41,6 +43,8 @@ const useLocale = () => {
|
|
|
41
43
|
const CUSTOM_TIMEZONE_KEY = "customTimeZone";
|
|
42
44
|
const readTimezoneFromStorage = () => {
|
|
43
45
|
try {
|
|
46
|
+
// TODO: migrate to useLocalStorage hook — this file was exempted when the no-direct-storage-access rule was introduced
|
|
47
|
+
// eslint-disable-next-line no-restricted-globals
|
|
44
48
|
const raw = localStorage.getItem(CUSTOM_TIMEZONE_KEY);
|
|
45
49
|
if (raw === null)
|
|
46
50
|
return null;
|
|
@@ -85,9 +89,11 @@ const useTimezone = () => {
|
|
|
85
89
|
const setCustomTimezone = useCallback((timezone) => {
|
|
86
90
|
setLocalStorageCustomTimezone(timezone);
|
|
87
91
|
if (timezone === null) {
|
|
92
|
+
// eslint-disable-next-line no-restricted-globals
|
|
88
93
|
localStorage.removeItem(CUSTOM_TIMEZONE_KEY);
|
|
89
94
|
}
|
|
90
95
|
else {
|
|
96
|
+
// eslint-disable-next-line no-restricted-globals
|
|
91
97
|
localStorage.setItem(CUSTOM_TIMEZONE_KEY, JSON.stringify(timezone));
|
|
92
98
|
}
|
|
93
99
|
}, []);
|
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-date-and-time-hooks",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.9",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=24.x"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@trackunit/date-and-time-utils": "1.13.
|
|
11
|
-
"@trackunit/iris-app-runtime-core-api": "1.16.
|
|
12
|
-
"@trackunit/shared-utils": "1.15.
|
|
13
|
-
"@trackunit/react-core-hooks": "1.17.
|
|
10
|
+
"@trackunit/date-and-time-utils": "1.13.19",
|
|
11
|
+
"@trackunit/iris-app-runtime-core-api": "1.16.18",
|
|
12
|
+
"@trackunit/shared-utils": "1.15.18",
|
|
13
|
+
"@trackunit/react-core-hooks": "1.17.22"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@trackunit/react-core-contexts-test": "1.17.
|
|
16
|
+
"@trackunit/react-core-contexts-test": "1.17.18"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"react": "^19.0.0"
|