You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expected behavior days value should be 6. display value should be 19 years, 3 months, 6 days. totalMonths value should be 231.##.
I understand that dayjs is calculating the number of Milliseconds and then dividing it by number of milliseconds in the year, month, etc, to find the result for them.
But when we say the duration between two dates are 19 years, 3 months and 11 days, those 19 years are not equal in the number of milliseconds.
I think the following line of code doesn't consider leap years:
constMILLISECONDS_A_YEAR=MILLISECONDS_A_DAY*365
There are 4 leap years between the above days, and 11 will reduce to 7.
Information
Day.js Version 1.11.11
OS: Windows 11
Browser: node v18.20.1
Time zone: BST
The text was updated successfully, but these errors were encountered:
Describe the bug
The following code calculates the duration between two dates: (playground)
Result using dayjs@1.11.11 and dayjs@1.11.10 is:
Result using dayjs <= 1.11.09 is:
The result of the code when using
diff
(playground) is not different.Expected behavior
days
value should be6
.display
value should be19 years, 3 months, 6 days
.totalMonths
value should be231.##
.I understand that dayjs is calculating the number of Milliseconds and then dividing it by number of milliseconds in the year, month, etc, to find the result for them.
But when we say the duration between two dates are
19 years, 3 months and 11 days
, those 19 years are not equal in the number of milliseconds.I think the following line of code doesn't consider leap years:
There are 4 leap years between the above days, and 11 will reduce to 7.
Information
The text was updated successfully, but these errors were encountered: