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:
Anik Dhabal Babu
2025-06-26 09:36:44 +00:00
committed by GitHub
parent 6983179b2f
commit c10f15e75b
@@ -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>
)}