0

I am building an app using node.js + postgresql. My postgresql stores dates in the format:

2016-04-01T04:00:00.000Z

When the date is returned to the browser, I want the date to be returned in the timezone of the user. Is there a way I can do this? I found moment.js but I'm not sure if it actually detects a user/browser's timezone for the conversion or not...

Can someone help? Thanks in advance!

Trung Tran
  • 13,141
  • 42
  • 113
  • 200

1 Answers1

0

If you want suport multitimezone, you should have in db unix timestamps. Moment js Is really good lib for an time calculation. Moment js can detect browser timezone. Of course you always use vanilia like https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset

Dominik Kajzar
  • 124
  • 1
  • 11