2 ms·
The tricky part is the conversion process from the server to the client. As JavaScript doesn't have any way to make dates with specific timezones other than the
by pinetlk 5y ago
The tricky part is the conversion process from the server to the client. As JavaScript doesn't have any way to make dates with specific timezones other than the local timezone, you have to do some things to make up for it.
In my last project, I convert the time using the timezone information I have stored by doing t at time zone x in postgres, so that it shows the time at that location, but then when it gets to the client, the actual Date object underneath is in the local timezone, even though it is displaying the time in a different timezone. It doesn't really matter because it is just for display purposes essentially.
When I send the time back to the server, I strip the timezone information from the date object and add in my own timezone information to a newly created string in a postgres-specific format and send it back.