Issue
I am having trouble with the timezone in Appsmith. The Table widget displays my database dates as three hours behind the actual time. I need to adjust the Display Format to add three hours, but I am not sure how to do it.
Resolution
Appsmith was displaying database dates with a timezone offset of -3 hours due to the server location. To adjust the display format without changing the way dates are saved, the moment.js library with timezone information can be used in the Display Format of the column.
In the column settings pane, select the date column and go to the Display Format section. Use the following code syntax to adjust the timezone offset:
moment.tz(value, 'UTC').tz('YOUR_TIMEZONE_HERE').format('YYYY-MM-DD HH:mm:ss')
Replace YOUR_TIMEZONE_HERE
with the timezone name (e.g. 'America/New_York') where the Appsmith application is being used.
This code will convert the timezone of the Database date to the selected timezone ('YOUR_TIMEZONE_HERE'
) and format it according to the specified format.
After saving the Display Format, the date should now display correctly with the adjusted timezone offset.