fix: Change Detroit to New York as a default for EST time zone (#8218)

Co-authored-by: gitstart-calcom <[email protected]>
Co-authored-by: Peer Richelsen <[email protected]>
Co-authored-by: alannnc <[email protected]>
Co-authored-by: Omar López <[email protected]>
This commit is contained in:
authored and GitHub committed 2023-05-29 19:57:34 +01:00
1 parent ada8e19715
commit 5640e2eb25
3 files changed
+14 -4

No files matched your search

+2 -1
View File
@@ -35,5 +35,6 @@ export const addCitiesToDropdown = (cities: ICity[]) => {
export const handleOptionLabel = (option: ITimezoneOption, cities: ICity[]) => {
const timezoneValue = option.label.split(")")[0].replace("(", " ").replace("T", "T ");
const cityName = option.label.split(") ")[1];
return cities.length > 0 ? `${cityName}${timezoneValue}` : `${option.value}${timezoneValue}`;
const refactoredOption = option.value.replace(/_/g, " ");
return cities.length > 0 ? `${cityName}${timezoneValue}` : `${refactoredOption}${timezoneValue}`;
};
@@ -34,6 +34,13 @@ export function TimezoneSelect({
});
}, [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 (
<BaseSelect
className={className}
@@ -41,13 +48,15 @@ export function TimezoneSelect({
isDisabled={isLoading}
{...reactSelectProps}
timezones={{
...allTimezones,
...modifiedTimezones,
...addCitiesToDropdown(cities),
"America/Asuncion": "Asuncion",
}}
onInputChange={handleInputChange}
{...props}
formatOptionLabel={(option) => <p className="truncate">{(option as ITimezoneOption).value}</p>}
formatOptionLabel={(option) => (
<p className="truncate">{(option as ITimezoneOption).value.replace(/_/g, " ")}</p>
)}
getOptionLabel={(option) => handleOptionLabel(option as ITimezoneOption, cities)}
classNames={{
...timezoneClassNames,