Incorrect timezone with "Minimum Date" on DateTime selector validator

Hello Retool peeps, there's something really weird going on with my DateTime minimum date validator.

I have the following DateTime picker to select the Start DateTime of an event:

As you can see, the timezone is set as America/Toronto (GMT -0500).

So for the End DateTime picker, I want to use StartDateTime.value as the minimum date. However, it seems to convert the value to the local timezone regardless of what I do. This can lead to a side effect where the Minimum Date is actually a day after the intended date:

You can see this happening here, when I mouse over value (which is in the correct -0500 date time), but the Min Date parsed string is +1000 (because I've set my local timezone to the Philippines):

image

Any advice would be appreciated.

Use the moment library to set a particular timezone

{{moment(calenderDateEntryOTStart.value).tz('UTC')}} 

https://momentjs.com/docs/

That actually doesn't work, the issue is that Min Date stubbornly converts the time to the local timezone for Min Date.

image

But that got me on the right track. Figured it out with this code:

{{ moment(calendarDataEntryDTStart.value).tz(calendarDataEntryAllDay.value == true ? 'UTC' : selectedUser.data.timezone || 'local').toISOString(true) }}

You read in with moment, set the timezone, then use toISOString(true) to keep the offset.

1 Like

Hey @Daniel_Podlovics! This has been fixed in the product now :slight_smile: Thank you for reporting this. The fix will be coming with our next Cloud release (which is usually sometime midweek) :soon::confetti_ball: