react-timezone-select 3.3.1 → 3.3.3
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/dist/index.js +17 -8
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -46,6 +46,7 @@ var allTimezones = {
|
|
|
46
46
|
"America/Dawson": "Dawson, Yukon",
|
|
47
47
|
"America/Chihuahua": "Chihuahua, La Paz, Mazatlan",
|
|
48
48
|
"America/Phoenix": "Arizona",
|
|
49
|
+
"America/Los_Angeles": "Pacific Time",
|
|
49
50
|
"America/Chicago": "Central Time",
|
|
50
51
|
"America/Regina": "Saskatchewan",
|
|
51
52
|
"America/Mexico_City": "Guadalajara, Mexico City, Monterrey",
|
|
@@ -60,7 +61,6 @@ var allTimezones = {
|
|
|
60
61
|
"America/Montevideo": "Montevideo",
|
|
61
62
|
"America/Argentina/Buenos_Aires": "Buenos Aires, Georgetown",
|
|
62
63
|
"America/Godthab": "Greenland",
|
|
63
|
-
"America/Los_Angeles": "Pacific Time",
|
|
64
64
|
"Atlantic/Azores": "Azores",
|
|
65
65
|
"Atlantic/Cape_Verde": "Cape Verde Islands",
|
|
66
66
|
GMT: "UTC",
|
|
@@ -164,20 +164,29 @@ function useTimezoneSelect({
|
|
|
164
164
|
label,
|
|
165
165
|
offset: tz.current.offset,
|
|
166
166
|
abbrev: abbr,
|
|
167
|
-
altName
|
|
167
|
+
altName,
|
|
168
|
+
hasDst: tz.hasDst
|
|
168
169
|
};
|
|
169
170
|
} catch (e) {
|
|
170
171
|
return null;
|
|
171
172
|
}
|
|
172
173
|
}).filter(Boolean).sort((a, b) => a.offset - b.offset);
|
|
173
174
|
}, [labelStyle, timezones, currentDatetime]);
|
|
175
|
+
const customTimezoneKeys = useMemo(() => {
|
|
176
|
+
const defaultKeys = new Set(Object.keys(timezone_list_default));
|
|
177
|
+
return new Set(Object.keys(timezones).filter((key) => !defaultKeys.has(key)));
|
|
178
|
+
}, [timezones]);
|
|
174
179
|
const options = useMemo(() => {
|
|
175
|
-
return allOptions.filter(
|
|
176
|
-
(
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
180
|
+
return allOptions.filter((item, idx, arr) => {
|
|
181
|
+
if (customTimezoneKeys.has(item.value)) return true;
|
|
182
|
+
return arr.findIndex((t) => t.offset === item.offset && t.hasDst === item.hasDst) === idx;
|
|
183
|
+
}).map((_a) => {
|
|
184
|
+
var _b = _a, { hasDst: _ } = _b, item = __objRest(_b, ["hasDst"]);
|
|
185
|
+
return __spreadProps(__spreadValues({}, item), {
|
|
186
|
+
searchTerms: allOptions.filter((t) => t.offset === item.offset && t.hasDst === _).map((t) => t.label).join(" ")
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
}, [allOptions, customTimezoneKeys]);
|
|
181
190
|
const filterOption = (option, inputValue) => {
|
|
182
191
|
var _a, _b, _c;
|
|
183
192
|
const data = option.data;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-timezone-select",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.3",
|
|
4
4
|
"description": "Usable, dynamic React Timezone Select",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "concurrently \"tsup --watch\" \"cd example && pnpm dev\"",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"react": "^16 || ^17.0.1 || ^18 || ^19",
|
|
45
45
|
"react-dom": "^16 || ^17.0.1 || ^18 || ^19",
|
|
46
|
-
"react-select": "^5.
|
|
46
|
+
"react-select": "^5.9.0"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"spacetime": "^7.12.0",
|