dayjs icon indicating copy to clipboard operation
dayjs copied to clipboard

Weird issue of toNow it should be 1 day, but its giving me 33 day

Open johnatato opened this issue 3 years ago • 1 comments

Describe the bug the toNow has a weird behavior on a specific date, so the scenario is

Todays date: Dec 26, 2022 (GMT+8) Date to be formatted: 2022-12-27T12:00:00-05:00 toNow: 33 day dayjs('2022-12-27T12:00:00-05:00').toNow(true)

so as you can see, its wrong, i dont know why its giving me 33 day, so i tried to use other days so i changed the 12-27 to 12-28, now it gives me 2 days value which is right. So i tried changing the value again to 12-29 and it gives me 3 days which is also right.

So i dont know why its doing this

Expected behavior It should be 1 day

Information

  • Day.js Version v1.11.5
  • OS: Mac OS
  • Browser Brave [Version 1.46.144]
  • Time zone: GMT+ 8

johnatato avatar Dec 26 '22 08:12 johnatato

I'm also having a weird issue using toNow

dayjs('2024-03-12').toNow() is evaluating as in 10 days

today's Date is the 21st of March 2024

minimal reproduction https://stackblitz.com/edit/vitejs-vite-d2m13u?file=main.js

please take a look, thank you.

dej10 avatar Mar 21 '24 20:03 dej10