react-timezone-select
Advanced tools
Comparing version 3.1.0 to 3.2.0
@@ -21,2 +21,3 @@ import * as react_jsx_runtime_js from 'react/jsx-runtime.js'; | ||
timezones?: ICustomTimezone; | ||
currentDatetime?: Date | string; | ||
}; | ||
@@ -30,8 +31,8 @@ type Props = Omit<Props$1<ITimezone, false>, 'onChange'> & TimezoneSelectOptions & { | ||
declare function useTimezoneSelect({ timezones, labelStyle, displayValue, }: TimezoneSelectOptions): { | ||
declare function useTimezoneSelect({ timezones, labelStyle, displayValue, currentDatetime, }: TimezoneSelectOptions): { | ||
parseTimezone: (zone: ITimezone) => ITimezoneOption; | ||
options: ITimezoneOption[]; | ||
}; | ||
declare const TimezoneSelect: ({ value, onBlur, onChange, labelStyle, displayValue, timezones, ...props }: Props) => react_jsx_runtime_js.JSX.Element; | ||
declare const TimezoneSelect: ({ value, onBlur, onChange, labelStyle, displayValue, timezones, currentDatetime, ...props }: Props) => react_jsx_runtime_js.JSX.Element; | ||
export { ILabelStyle, ITimezone, ITimezoneOption, Props, TimezoneSelectOptions, allTimezones, TimezoneSelect as default, useTimezoneSelect }; |
@@ -125,3 +125,4 @@ var __defProp = Object.defineProperty; | ||
labelStyle = "original", | ||
displayValue = "GMT" | ||
displayValue = "GMT", | ||
currentDatetime | ||
}) { | ||
@@ -132,3 +133,3 @@ const options = useMemo(() => { | ||
try { | ||
const now = spacetime.now(zone[0]); | ||
const now = (currentDatetime ? spacetime(currentDatetime) : spacetime.now()).goto(zone[0]); | ||
const isDstString = now.isDST() ? "daylight" : "standard"; | ||
@@ -174,5 +175,5 @@ const tz = now.timezone(); | ||
try { | ||
currentTime = spacetime.now(zone); | ||
currentTime = (currentDatetime ? spacetime(currentDatetime) : spacetime.now()).goto(zone); | ||
} catch (err) { | ||
currentTime = spacetime.now("GMT"); | ||
currentTime = (currentDatetime ? spacetime(currentDatetime) : spacetime.now()).goto("GMT"); | ||
} | ||
@@ -222,3 +223,4 @@ return options.filter( | ||
displayValue, | ||
timezones | ||
timezones, | ||
currentDatetime | ||
} = _b, props = __objRest(_b, [ | ||
@@ -230,3 +232,4 @@ "value", | ||
"displayValue", | ||
"timezones" | ||
"timezones", | ||
"currentDatetime" | ||
]); | ||
@@ -236,3 +239,4 @@ const { options, parseTimezone } = useTimezoneSelect({ | ||
labelStyle, | ||
displayValue | ||
displayValue, | ||
currentDatetime | ||
}); | ||
@@ -239,0 +243,0 @@ const handleChange = (tz) => { |
{ | ||
"name": "react-timezone-select", | ||
"version": "3.1.0", | ||
"version": "3.2.0", | ||
"description": "Usable, dynamic React Timezone Select", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -133,2 +133,3 @@ # đâ react-timezone-select | ||
- `timezones` - `Record<string,string>` | ||
- `currentDatetime` - `Date | string` - Set datetime used to calculate timezone values (alternative to current datetime) | ||
``` | ||
@@ -135,0 +136,0 @@ timezones={{ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20815
283
180