From 87b36e417df0b8fc082461232106a85fab4322a7 Mon Sep 17 00:00:00 2001 From: Ben Grant Date: Wed, 12 May 2021 21:48:57 +1000 Subject: [PATCH] Timezone helper links --- crabfit-frontend/src/pages/Event/Event.tsx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/crabfit-frontend/src/pages/Event/Event.tsx b/crabfit-frontend/src/pages/Event/Event.tsx index a0184e1..cfb415b 100644 --- a/crabfit-frontend/src/pages/Event/Event.tsx +++ b/crabfit-frontend/src/pages/Event/Event.tsx @@ -366,6 +366,22 @@ const Event = (props) => { onChange={event => setTimezone(event.currentTarget.value)} options={timezones} /> + {event?.timezone && event.timezone !== timezone &&

This event was created in the timezone {event.timezone}. { + e.preventDefault(); + setTimezone(event.timezone); + }}>Click here to use it.

} + {(( + Intl.DateTimeFormat().resolvedOptions().timeZone !== timezone + && (event?.timezone && event.timezone !== Intl.DateTimeFormat().resolvedOptions().timeZone) + ) || ( + event?.timezone === undefined + && Intl.DateTimeFormat().resolvedOptions().timeZone !== timezone + )) && ( +

Your local timezone is detected to be {Intl.DateTimeFormat().resolvedOptions().timeZone}. { + e.preventDefault(); + setTimezone(Intl.DateTimeFormat().resolvedOptions().timeZone); + }}>Click here to use it.

+ )}