Diving into the world of timezone - my goal is that if a user picks a date-time with the date picker, say 24 Aug 2023, 13:00. Then regardless of their timezone, I’d like to store it as 24 Aug 2023, 13:00 Timezone Europe/London.
I.e. it’s leaving the date alone but changing the timezone context.
I think I can do this by manually reconstructing the date/time string, but is there an easier way to do this via any of the components?
Reason I want to do this is that I am handling timesheets and it’s very possible that someone is filling in their timesheet after they are on holiday in a different timezone. Naturally the user will still be filling in the date/time with the timezone context of the physical office rather than where they are physically.
Dates are automatically stored in the GMT0 timezone in the database. When the UI retrieves a date, it will be converted to the timezone where the user is.
It sounds to me that you want to convert the selected time to some other “fixed” timezone before the date is saved in the DB.
Spot on Mark. I need to take the user’s input (say 24 Aug 2023, 19:00:00), but append the timezone Europe/London (which is complicated since whether that’s GMT+1 or GMT depends on the actual date… and the actual date is not fixed)
Thanks Mark - that’s what I tried first, but the outcome isn’t what I wanted since it takes the selectedDate and then represent it in a different timezone, meaning if I enter the date in GMT+2, and the current UK timezone is GMT+1, then the results is adjusted.
In any case, I’m happy now with the custom code block and thank you again for the response.