Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duration add/subtract doesn't take into account how many days in a month #2336

Open
alexander-ulaev opened this issue Jun 15, 2023 · 0 comments

Comments

@alexander-ulaev
Copy link
Contributor

alexander-ulaev commented Jun 15, 2023

Describe the bug
methods add and subtract with duration object doesn't take into account how many days in a month

// actual

dayjs('2023-02-01').add(dayjs.duration(1, 'month')) === "2023-03-03"
dayjs('2023-03-01').subtract(dayjs.duration(1, 'month')) === "2023-01-30"

Expected behavior

// expected

dayjs('2023-02-01').add(dayjs.duration(1, 'month')) === "2023-03-01"
dayjs('2023-03-01').subtract(dayjs.duration(1, 'month')) === "2023-02-01"

Information

  • Day.js v1.11.8
  • OS: Ubuntu 23.04
  • Browser: chrome 114.0.5735.133
  • Time zone: GMT +04:00 Europe/Samara
alexander-ulaev added a commit to alexander-ulaev/dayjs that referenced this issue Jun 15, 2023
alexander-ulaev added a commit to alexander-ulaev/dayjs that referenced this issue Jun 23, 2023
alexander-ulaev added a commit to alexander-ulaev/dayjs that referenced this issue Jun 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant