react-timezone-select
Advanced tools
Comparing version 2.1.1 to 2.1.2
import { Props as Props$1 } from 'react-select'; | ||
type ICustomTimezone = { | ||
declare type ICustomTimezone = { | ||
[key: string]: string; | ||
}; | ||
type ILabelStyle = 'original' | 'altName' | 'abbrev'; | ||
type ITimezoneOption = { | ||
declare type ILabelStyle = 'original' | 'altName' | 'abbrev'; | ||
declare type IDisplayValue = 'GMT' | 'UTC'; | ||
declare type ITimezoneOption = { | ||
value: string; | ||
@@ -14,9 +15,10 @@ label: string; | ||
}; | ||
type ITimezone = ITimezoneOption | string; | ||
type TimezoneSelectOptions = { | ||
declare type ITimezone = ITimezoneOption | string; | ||
declare type TimezoneSelectOptions = { | ||
labelStyle?: ILabelStyle; | ||
displayValue?: IDisplayValue; | ||
timezones?: ICustomTimezone; | ||
maxAbbrLength?: number; | ||
}; | ||
type Props = Omit<Props$1<ITimezone, false>, 'onChange'> & TimezoneSelectOptions & { | ||
declare type Props = Omit<Props$1<ITimezone, false>, 'onChange'> & TimezoneSelectOptions & { | ||
value: ITimezone; | ||
@@ -28,8 +30,8 @@ onChange?: (timezone: ITimezoneOption) => void; | ||
declare function useTimezoneSelect({ timezones, labelStyle, maxAbbrLength, }: TimezoneSelectOptions): { | ||
declare function useTimezoneSelect({ timezones, labelStyle, displayValue, maxAbbrLength, }: TimezoneSelectOptions): { | ||
parseTimezone: (zone: ITimezone) => ITimezoneOption; | ||
options: ITimezoneOption[]; | ||
}; | ||
declare const TimezoneSelect: ({ value, onBlur, onChange, labelStyle, maxAbbrLength, timezones, ...props }: Props) => JSX.Element; | ||
declare const TimezoneSelect: ({ value, onBlur, onChange, labelStyle, displayValue, maxAbbrLength, timezones, ...props }: Props) => JSX.Element; | ||
export { ILabelStyle, ITimezone, ITimezoneOption, Props, TimezoneSelectOptions, allTimezones, TimezoneSelect as default, useTimezoneSelect }; |
@@ -76,6 +76,6 @@ var __defProp = Object.defineProperty; | ||
"Europe/Helsinki": "Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius", | ||
"Europe/Athens": "Athens, Minsk", | ||
"Europe/Athens": "Athens", | ||
"Asia/Jerusalem": "Jerusalem", | ||
"Africa/Harare": "Harare, Pretoria", | ||
"Europe/Moscow": "Istanbul, Moscow, St. Petersburg, Volgograd", | ||
"Europe/Moscow": "Istanbul, Minsk, Moscow, St. Petersburg, Volgograd", | ||
"Asia/Kuwait": "Kuwait, Riyadh", | ||
@@ -125,2 +125,3 @@ "Africa/Nairobi": "Nairobi", | ||
labelStyle = "original", | ||
displayValue = "GMT", | ||
maxAbbrLength = 4 | ||
@@ -144,3 +145,3 @@ }) { | ||
const hr = `${min / 60 ^ 0}:` + (min % 60 === 0 ? "00" : Math.abs(min % 60)); | ||
const prefix = `(GMT${hr.includes("-") ? hr : `+${hr}`}) ${zone[1]}`; | ||
const prefix = `(${displayValue}${hr.includes("-") ? hr : `+${hr}`}) ${zone[1]}`; | ||
switch (labelStyle) { | ||
@@ -220,2 +221,3 @@ case "original": | ||
labelStyle, | ||
displayValue, | ||
maxAbbrLength, | ||
@@ -228,2 +230,3 @@ timezones | ||
"labelStyle", | ||
"displayValue", | ||
"maxAbbrLength", | ||
@@ -235,2 +238,3 @@ "timezones" | ||
labelStyle, | ||
displayValue, | ||
maxAbbrLength | ||
@@ -237,0 +241,0 @@ }); |
{ | ||
"name": "react-timezone-select", | ||
"version": "2.1.1", | ||
"version": "2.1.2", | ||
"description": "Usable, dynamic React Timezone Select", | ||
"scripts": { | ||
"dev": "concurrently \"tsup src/index.tsx --format esm --watch\" \"cd example && pnpm dev\"", | ||
"prepublishOnly": "pnpm run build", | ||
"postpublish": "pnpm run build:example && npm run deploy", | ||
"build": "tsup src/index.tsx --format cjs,esm --dts", | ||
"build:example": "cd example && pnpm run build", | ||
"deploy": "gh-pages -d example/dist", | ||
"pretest": "pnpm run build", | ||
"test": "jest", | ||
"test:watch": "jest --watch", | ||
"test:ci": "pnpm run build && jest --ci ", | ||
"tsc": "tsc" | ||
}, | ||
"author": "Nico Domino <yo@ndo.dev>", | ||
@@ -117,3 +104,14 @@ "homepage": "https://github.com/ndom91/react-timezone-select", | ||
] | ||
}, | ||
"scripts": { | ||
"dev": "concurrently \"tsup src/index.tsx --format esm --watch\" \"cd example && pnpm dev\"", | ||
"build": "tsup src/index.tsx --format cjs,esm --dts", | ||
"build:example": "cd example && pnpm run build", | ||
"deploy": "gh-pages -d example/dist", | ||
"pretest": "pnpm run build", | ||
"test": "jest", | ||
"test:watch": "jest --watch", | ||
"test:ci": "pnpm run build && jest --ci ", | ||
"tsc": "tsc" | ||
} | ||
} | ||
} |
@@ -129,2 +129,3 @@ # đâ react-timezone-select | ||
- `labelStyle` - `'original' | 'altName' | 'abbrev'` | ||
- `displayValue` - `'GMT' | 'UTC'` | ||
- `timezones` - `Record<string,string>` | ||
@@ -131,0 +132,0 @@ ``` |
Sorry, the diff of this file is not supported yet
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
42585
845
178
7