Datetime field is no longer dynamic

I am experiencing the same issue as described in this post from about 2 months ago.

https://community.retool.com/t/datetime-field-is-not-dynamic-like-it-used-to-be/56963

I am using dynamic selection of time zones to show users when tickets are submitted in the data base. This use to work with no errors but now when editing a time it no longer submits their local time, it submits UTC time from their local time. Then will do the conversion again when loading.

For example:

Database original - 10:15 am Texas Time (-5)
Change to - 10:30 am Texas Time (-5)
Database saves as - 10:30am UTC (0)
New loaded time - 5:30am Texas Time (-5)

This creates an offset when saving new dates. This use to not be an issue but I'm noticing it with the dateTime component and updating dateTime in tables.

How can I resolve this?

Thank you

1 Like

Hey @drkb ,

I noticed you encountered a datetime error related to the UTC timezone. In Retool, there's a useful setting called Manage Timezone that can help handle this more effectively.

When this option is enabled, Retool provides two fields:

  • Display Timezone – how the time appears to users
  • Value Timezone – how the time is stored or sent to the backend

This is especially helpful when you're dealing with different timezones across your team or user base.

Below are two images showing how this works:

  1. Editable table with a datetime data type field:

  2. Standard datetime component configuration:

Make sure you align both the display and value timezones according to your application's requirements to avoid any confusion or data mismatch.

Let me know if you need help configuring this or debugging further!

Let me explain more. I want to emphasis this use to work without issue for over 3 months and then suddenly it updates incorrectly similarly to the linked community post above.

The timezone is being controlled by the user dynamically.

image

The datetime is showing UTC

image

The user is able to change the timezone by the select at the top and the dates in the table would properly update. That still works but when editing an entry the datetime is not respecting the users local time like it use to.

Pre edited date:
image

edited to 9:30

image

I save it and refresh, it then loads as

image

I believe this issue is when happening because when saving the date it no longer respects the users local time. I don't know what I can do in the save event handler in order to stop this from happening as I'm just updating off the changeset array.

When I look at the previous post it looked like it was something the Retool team updated that ended up fixing it. Any additional help is greatly appreciated.

1 Like

Hey @drkb,

Thanks for your response! I'd like to provide more details to help clarify the issue.

As you mentioned, users should be able to select their timezone dynamically. To support this, I created a transformer to populate the timezone options in the tab component. Here's the code I used:

return [
  { "label": "CST", "value": "-06:00" },
  { "label": "PST", "value": "-08:00" },
  { "label": "MST", "value": "-07:00" },
  { "label": "EST", "value": "-05:00" },
  { "label": "AKST", "value": "-09:00" },
  { "label": "HST", "value": "-10:00" },
  { "label": "NST", "value": "-03:30" },
  { "label": "AST", "value": "-04:00" }
]

Here's how it looks in the UI:

On the datetime field, I made the value dynamic by referencing the selected tab’s value:

{{ tabs1.value }}

This approach ensures that the date and time selected by the user are saved according to their chosen timezone offset. The goal is to have user inputs correctly recorded based on the timezone selected via tabs, which should help with proper time tracking across regions.

Let me know if you have any suggestions or see any potential improvements. Thanks again!

That solution fixed the issue!

Thank you very much for the help. I really appreciate it.

2 Likes