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

dayjs add duration returns Invalid Date #2364

Closed
otto-kirchheim opened this issue Jul 2, 2023 · 3 comments · Fixed by #2369
Closed

dayjs add duration returns Invalid Date #2364

otto-kirchheim opened this issue Jul 2, 2023 · 3 comments · Fixed by #2369
Labels
☢️Bug Something isn't working released

Comments

@otto-kirchheim
Copy link

Describe the bug
dayjs().add(dayjs.duration({ "hours" : 7, "minutes" : 10) }))

returns "invalid Date"
only "hours" and "minutes" are in the duration object

dayjs.duration(7, "hours").add(10, "minutes") is working

Information

  • Day.js Version 1.11.9
  • Time zone: GMT+02:00 [MESZ]
@max-nicholson
Copy link

max-nicholson commented Jul 3, 2023

Can reproduce after upgrading from 1.11.7 to 1.11.9.

Example usage

dayjs.extend(duration)
dayjs.extend(utc)
dayjs.extend(objectSupport)

// Invalid Date
dayjs.utc({ hours: 11, minutes: 30, seconds: 0} ).add(dayjs.duration({ hours: 11, minutes: 0, seconds: 0 })

I've used dayjs().add(duration.asSeconds(), 'seconds') as a workaround which works for my usecase

@iamkun
Copy link
Owner

iamkun commented Jul 4, 2023

will fix soon

@github-actions
Copy link

🎉 This issue has been resolved in version 1.11.10 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
☢️Bug Something isn't working released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants