Category: How do I do X?


This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

Controlling Displayed Time Zone in Datepicker Default Date


I need the Datepicker widget to display a timestamp from a database in the time zone that an event took place in instead of the user's local timezone. Despite using moment to convert the timestamp to the desired timezone, the widget still displays the date in my local timezone. After trying a few solutions, using the Date() function with the correct timezone parameter resolved the issue.


In this scenario, the goal was to display a time stamp from a database in the time zone that an event took place in, rather than the local timezone of the person using the application. The application was using the Datepicker widget, which was not displaying the correct time zone.

The solution involved using the Javascript Date() function and its options to specify the desired timezone. Specifically, the following code was used:

{{new Date('2022-12-01T12:00:00.000-00:00').toLocaleString('en-US', { timeZone: 'US/Eastern' })}}

This code takes the UTC time from the database, converts it to Eastern timezone, and displays it in the desired format. This works because the Date() function can take a timezone option, which allows for displaying the time in a specific timezone regardless of the user's local timezone.

This solution was successful in displaying the correct timezone in both the evaluated value and the actual displayed date on the Datepicker widget.