react-timezone-select 3.2.4 → 3.2.6
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.d.ts +4 -4
- package/dist/index.js +6 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ import { Props as Props$1 } from 'react-select';
|
|
|
4
4
|
type ICustomTimezone = {
|
|
5
5
|
[key: string]: string;
|
|
6
6
|
};
|
|
7
|
-
type ILabelStyle =
|
|
8
|
-
type IDisplayValue =
|
|
7
|
+
type ILabelStyle = "original" | "altName" | "abbrev" | "offsetHidden";
|
|
8
|
+
type IDisplayValue = "GMT" | "UTC";
|
|
9
9
|
type ITimezoneOption = {
|
|
10
10
|
value: string;
|
|
11
11
|
label: string;
|
|
@@ -20,9 +20,9 @@ type TimezoneSelectOptions = {
|
|
|
20
20
|
timezones?: ICustomTimezone;
|
|
21
21
|
currentDatetime?: Date | string;
|
|
22
22
|
};
|
|
23
|
-
type Props = Omit<Props$1<ITimezone, false>,
|
|
23
|
+
type Props = Omit<Props$1<ITimezone, false>, "onChange"> & TimezoneSelectOptions & {
|
|
24
24
|
value: ITimezone;
|
|
25
|
-
onChange?: (timezone:
|
|
25
|
+
onChange?: (timezone: ITimezoneOption) => void;
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
declare const allTimezones: ICustomTimezone;
|
package/dist/index.js
CHANGED
|
@@ -196,13 +196,16 @@ function useTimezoneSelect({
|
|
|
196
196
|
return { tz, score };
|
|
197
197
|
}).sort((a, b) => b.score - a.score)) == null ? void 0 : _a[0]) == null ? void 0 : _b.tz;
|
|
198
198
|
};
|
|
199
|
+
function isObject(item) {
|
|
200
|
+
return typeof item === "object" && !Array.isArray(item) && item !== null;
|
|
201
|
+
}
|
|
199
202
|
const parseTimezone = (zone) => {
|
|
200
|
-
if (typeof zone === "object" && zone.value && zone.label)
|
|
201
|
-
return zone;
|
|
202
203
|
if (typeof zone === "string") {
|
|
203
204
|
return options.find((tz) => tz.value === zone) || zone.indexOf("/") !== -1 && findFuzzyTz(zone);
|
|
204
|
-
} else if (zone
|
|
205
|
+
} else if (isObject(zone) && !zone.label) {
|
|
205
206
|
return options.find((tz) => tz.value === zone.value);
|
|
207
|
+
} else {
|
|
208
|
+
return zone;
|
|
206
209
|
}
|
|
207
210
|
};
|
|
208
211
|
return { options, parseTimezone };
|
package/package.json
CHANGED