iamkun / dayjs

⏰ Day.js 2kB immutable date-time library alternative to Moment.js with the same modern API
https://day.js.org
MIT License
46.71k stars 2.28k forks source link

timezone some times diff with momoment #1621

Open int8array opened 3 years ago

int8array commented 3 years ago

Describe the bug dayjs.tz("2020-12-31T16:00:00.000Z", 'Europe/Paris').format('YYYY-MM-DD HH:mm:ss') = 2020-12-31 16:00:00 error moment.tz("2020-12-31T16:00:00.000Z", 'Europe/Paris').format('YYYY-MM-DD HH:mm:ss') = 2020-12-31 17:00:00 right

Expected behavior A clear and concise description of what you expected to happen.

Information

steponas commented 3 years ago

Yes, there are problems with Time zones in Dayjs, as mentioned in multiple issues here.

I started migrating some node.js code from moment to dayjs which works with time zones (as our clients are from all over the world), and have hit multiple test failures due to time zone bugs. I've stopped doing that - seems like Moment is still the date library I should be using in production, where timezones are important.

This has left me worried that I might been wrong in choosing a date lib to migrate to. Hope the PRs fixing tz issues will be merged in and things will get better!