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
const result = addDays(new Date('2024-02-15'), 0.5)
to be Fri Feb 16 2024 12:00:00. Instead it is Thu Feb 15 2024 00:00:00.
Suggested edits
Mention that the amount parameter is rounded to the nearest integer.
This also affects all functions that are only proxies to addDays, for instance subDays.
This might also affect the other {add,sub}{period} methods.
For reference: addDays(new Date('2024-02-15'), -0.9) is equal to addDays(new Date('2024-02-15'), -1), which means that the amount is always rounded down.
The text was updated successfully, but these errors were encountered:
fazil-shaik
pushed a commit
to fazil-shaik/date-fns
that referenced
this issue
Apr 3, 2024
There is an issue with the addDays documentation
The problem with addDays documentation
I expected
to be
Fri Feb 16 2024 12:00:00
. Instead it isThu Feb 15 2024 00:00:00
.Suggested edits
Mention that the
amount
parameter is rounded to the nearest integer.This also affects all functions that are only proxies to
addDays
, for instancesubDays
.This might also affect the other
{add,sub}{period}
methods.For reference:
addDays(new Date('2024-02-15'), -0.9)
is equal toaddDays(new Date('2024-02-15'), -1)
, which means that the amount is always rounded down.The text was updated successfully, but these errors were encountered: