fix: google calendar event creation failure due to invalid timezone (#22048)
* fix: google calendar event creation failure * update * fix type error * Update TimezoneSelect.tsx
This commit is contained in:
@@ -127,6 +127,24 @@ export function TimezoneSelectComponent({
|
||||
}}
|
||||
onInputChange={handleInputChange}
|
||||
{...props}
|
||||
onChange={(selectedOption) => {
|
||||
if (!props.onChange) return;
|
||||
|
||||
if (!selectedOption) {
|
||||
props.onChange(selectedOption);
|
||||
return;
|
||||
}
|
||||
|
||||
// Fix inconsistent timezone naming formats
|
||||
const corrections: Record<string, string> = {
|
||||
"America/Port_Of_Spain": "America/Port_of_Spain",
|
||||
"Africa/Porto-novo": "Africa/Porto-Novo",
|
||||
"Africa/Dar_Es_Salaam": "Africa/Dar_es_Salaam",
|
||||
};
|
||||
|
||||
const correctedValue = corrections[selectedOption.value] || selectedOption.value;
|
||||
props.onChange({ ...selectedOption, value: correctedValue });
|
||||
}}
|
||||
formatOptionLabel={(option) => (
|
||||
<p className="truncate">{(option as ITimezoneOption).value.replace(/_/g, " ")}</p>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user