iamkun / iamkun/dayjs

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

Open
#2,173 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
48.7k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

**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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.