fix: missing timezones in dropdown list (#10823)

fix-tokenHandler
David Oksman 2023-08-24 23:57:11 +03:00 committed by GitHub
parent f480afcace
commit 9f647ead46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 10 deletions

View File

@ -1,6 +1,6 @@
import { useMemo, useState } from "react"; import { useMemo, useState } from "react";
import type { ITimezoneOption, ITimezone, Props as SelectProps } from "react-timezone-select"; import type { ITimezoneOption, ITimezone, Props as SelectProps } from "react-timezone-select";
import BaseSelect, { allTimezones } from "react-timezone-select"; import BaseSelect from "react-timezone-select";
import { classNames } from "@calcom/lib"; import { classNames } from "@calcom/lib";
import { filterByCities, addCitiesToDropdown, handleOptionLabel } from "@calcom/lib/timezone"; import { filterByCities, addCitiesToDropdown, handleOptionLabel } from "@calcom/lib/timezone";
@ -34,13 +34,6 @@ export function TimezoneSelect({
}); });
}, [components]); }, [components]);
// We use modifiedTimezones in place of the allTimezones object replacing any underscores in the curly braces
// with spaces and removing the America/Detroit timezone, adding the America/New_York timezone instead.
const modifiedTimezones = useMemo(() => {
const { "America/Detroit": _, ...rest } = allTimezones;
return { ...rest, "America/New_York": "New York" };
}, []);
return ( return (
<BaseSelect <BaseSelect
className={className} className={className}
@ -48,9 +41,8 @@ export function TimezoneSelect({
isDisabled={isLoading} isDisabled={isLoading}
{...reactSelectProps} {...reactSelectProps}
timezones={{ timezones={{
...modifiedTimezones, ...(data ? addCitiesToDropdown(data) : {}),
...addCitiesToDropdown(cities), ...addCitiesToDropdown(cities),
"America/Asuncion": "Asuncion",
}} }}
onInputChange={handleInputChange} onInputChange={handleInputChange}
{...props} {...props}