-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Invalid duration when using partial object parameter in the creator #2633
Comments
Thanks for the great suggestion! Would you be open to submitting a pull request for this? |
jalooc
added a commit
to jalooc/dayjs
that referenced
this issue
Apr 28, 2024
…#2633) The Duration creator returned incomplete duration if passed the object parameter that's partial.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
The Duration creator returns incomplete duration if passed the object parameter that's partial:
Solution
Adding
this.parseFromMilliseconds()
in the constructor for the code branch handling the object parameter solves it:if (typeof input === 'object') { Object.keys(input).forEach((k) => { this.$d[prettyUnit(k)] = input[k] }) this.calMilliseconds() + this.parseFromMilliseconds() return this }
Information
The text was updated successfully, but these errors were encountered: