Incorrect Timezone Conversion Using `moment().tz`

Hi Retool team,

I used moment() to convert a timestamp column to a target timezone, but the output is incorrect. Could you please let me know how to solve this? Thank you in advance!!!

Detailed Description
The timestamp column stores UTC data. I used moment(self).tz('America/Los_Angeles) in the column Mapper for timezone conversion.

Expected Behavior
The column should display timestamp values converted to America/Los_Angeles.
For example, "2021-06-21 17:23:37.000" should be converted to and displayed as
"2021-06-21 10:23:37.000".

Actual Behavior

  1. If the column type is set to be the default, the actual result is "2021-06-21T09:23:37.000Z". There is one hour difference.
  2. If the column type is set to be the Date time (original timezone), the actual result is "Jun 21, 2021, 5:23:37 PM". The value is not converted at all.

Hi @doris.l !

It looks like the value you are passing into moment is not being treated as a UTC timestamp. If you run console.log(moment('2021-06-21 17:23:37.000')) the _isUTC value is set to false which is then causing the timezone conversions to be incorrect. Using moment.utc('2021-06-21 17:23:37.000') will force this to be a UTC moment object and then you can parse it with the timezone:


Hi @ben, it works! Thank you for the help.

Hello @ben,

I'm having the same issue, except using the Datepicker column type. I followed the guidance here and it seems to work with Date time (original timezone) but not Datepicker. Is there a way to force Datepicker column type to not adjust for the local timezone?

Thank you!

Hi @seth10001 !

Unfortunately, it looks like the datepicker inside the table will always adjust to display in local time. Sorry about this!

1 Like

@ben, thank you for the reply! that is unfortunate, but maybe I could move the editing to it's own form. Although I do enjoy the bulk edit feature that the table supports.