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.
Files changed (2) hide show
  1. package/dist/index.js +9 -4
  2. 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
- (item, idx, arr) => arr.findIndex((t) => t.offset === item.offset) === idx
177
- ).map((item) => __spreadProps(__spreadValues({}, item), {
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-timezone-select",
3
- "version": "3.3.1",
3
+ "version": "3.3.2",
4
4
  "description": "Usable, dynamic React Timezone Select",
5
5
  "scripts": {
6
6
  "dev": "concurrently \"tsup --watch\" \"cd example && pnpm dev\"",