We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi Guys,
I'm currently replacing moment-js with date-fns, but when it comes to timezone, I'm unable to get the same value.
moment-js
date-fns
Do you guys know what am I doing wrong?
const moment = require('moment-timezone'); const dateFNS = require('date-fns'); const dateFNSTimezone = require('date-fns-timezone'); const { format } = dateFNS; const { convertToTimeZone } = dateFNSTimezone; const TZ = 'America/Los_Angeles'; const a = moment().tz(TZ).format(); const b = format(convertToTimeZone(new Date(), { timeZone: TZ }), 'YYYY-MM-DDTHH:mm:ssZ'); console.log(a); // 2019-02-11T09:28:29-08:00 console.log(b); // 2019-02-11T09:28:29-02:00
if you notice the values are equal, execept the last part, where moment gives -08:00 but date-fns-timezone returns -02:00
-08:00
-02:00
The text was updated successfully, but these errors were encountered:
Hey @emersonbroga, is the local timezone of your system -02:00?
Sorry, something went wrong.
Hey, I'm having similarish issue. I use convertToTimeZone, but only the time is shifted, the timezone stays the sam (my system timezone)
No branches or pull requests
Hi Guys,
I'm currently replacing
moment-js
withdate-fns
, but when it comes to timezone, I'm unable to get the same value.Do you guys know what am I doing wrong?
if you notice the values are equal, execept the last part, where moment gives
-08:00
but date-fns-timezone returns-02:00
The text was updated successfully, but these errors were encountered: