[Time Zone] How to handle ConvertToUTC when local time is invalid due to daylight saving change
Forge component by André Vieira
Application Type
Reactive, Service

I am using ConvertToUTC to convert local times stored in my application to UTC, so that the times are correctly displayed in the reactive client.

The function throws an error when I try to convert 02:00 on 3 October 2021, from "AUS Eastern Standard Time".

DST is staring at 02:00 and 02:00 = 03:00 so I guess 02:00 is not a valid time.

Apart from hardcoding to skip the function in this case, are there any suggestions how to handle this?


There's really no good way to do this, unfortunately. :(


Thanks Justin. I had drawn that conclusion. The only thing that I could see/propose is that the function would respond with an agreed output, instead of throwing an exception.

Regards, Hubert.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.