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.24k stars 2.26k forks source link

Isoweek bug when customParseFormat is active #2632

Open Marouann opened 2 months ago

Marouann commented 2 months ago

Describe the bug When I try to get the iso week number from a date, the isoWeek function is not correct.

Information Bug has been reproduced in this sandbox

We get a very incoherent value :

That makes no sense, if A > B then A.isoWeek() >= B.isoWeek()

I don't really understand what is happening.

My guess is that when time is 23-23h59, the timezone makes the day change from 16 to 17 according to TZ. This day change leads to a decremented isoWeek.

I have tried to remove customParseFormat from used plugin and it started working. You can try it on the sandbox. However I need this plugin to make parse date in my TZ.

Thanks for your help.

klm-turing commented 2 months ago

@Marouann This PR fix the incorrect behaviour of ISO week plugin.