react-timezone-select 3.3.1 → 3.3.2
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 +9 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -171,13 +171,18 @@ function useTimezoneSelect({
|
|
|
171
171
|
}
|
|
172
172
|
}).filter(Boolean).sort((a, b) => a.offset - b.offset);
|
|
173
173
|
}, [labelStyle, timezones, currentDatetime]);
|
|
174
|
+
const customTimezoneKeys = useMemo(() => {
|
|
175
|
+
const defaultKeys = new Set(Object.keys(timezone_list_default));
|
|
176
|
+
return new Set(Object.keys(timezones).filter((key) => !defaultKeys.has(key)));
|
|
177
|
+
}, [timezones]);
|
|
174
178
|
const options = useMemo(() => {
|
|
175
|
-
return allOptions.filter(
|
|
176
|
-
(
|
|
177
|
-
|
|
179
|
+
return allOptions.filter((item, idx, arr) => {
|
|
180
|
+
if (customTimezoneKeys.has(item.value)) return true;
|
|
181
|
+
return arr.findIndex((t) => t.offset === item.offset) === idx;
|
|
182
|
+
}).map((item) => __spreadProps(__spreadValues({}, item), {
|
|
178
183
|
searchTerms: allOptions.filter((t) => t.offset === item.offset).map((t) => t.label).join(" ")
|
|
179
184
|
}));
|
|
180
|
-
}, [allOptions]);
|
|
185
|
+
}, [allOptions, customTimezoneKeys]);
|
|
181
186
|
const filterOption = (option, inputValue) => {
|
|
182
187
|
var _a, _b, _c;
|
|
183
188
|
const data = option.data;
|