Time zone issue on charts/tables

Hi there, I'm having an issue with time zones on custom charts/tables.

Almost everything I'm building pulls data from PostgreSQL that has dates in the YYYY-MM-DD format. When I query the database from Retool with specific date callouts (ie. "where date = '2023-12-01' "), everything functions properly.

As I'm pulling the data into custom charts and tables, there's an issue where the date shown is a day behind. I have a freelancer supporting me and he did a +T12H:00M offset in the chart code (see attached screenshot), which made the correct data show up under the correct dates.

However, at about 6pm CT every day, the next date starts showing up in the charts/tables. This feels like a UTC vs local time zone thing, but I can't figure out the code in the chart/table components (or if something else altogether is needed). Date format screenshot included as well for reference.

Screen Shot 2023-12-12 at 1.44.08 PM
Screen Shot 2023-12-12 at 1.44.43 PM

1 Like

Hi @thenatechambers

Thanks for joining office hours! Apologies that we didn't have more time to delve into this further

Can you use moment to format the dates in the proper timezone?

You could try doing this in a query transformer on the Postgres query, or you could try doing this only in components that need it.

Transform all of the Postgres dates:

Use moment in a component config:

For the Retool table specifically, you get some timezone controls (as well as the date time component) if you use the Datetime column and check on manage timezone

:crossed_fingers: Let us know if this results in the same issue. It may help to see the full component config for the impacted components.

1 Like

Hi @Tess , thanks so much for the response! I actually just figured this out. The issue was with the Date Range selector, specifically the End Date placeholder I was using. I was using "yesterday", which apparently was converting to UTC timezone date in the PostgreSQL query.

I changed to using a JavaScript query to find yesterday's date, and use that as the placeholder End Date in the Date Range selector, and that fixed the issue.

Thanks so much!

Ah okay! Thank you for sharing! I'm glad you found a solution :tada: :white_check_mark: