-
-
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
fix: duration.minutes() should guaranteed to be in [0, 60) #2338
base: dev
Are you sure you want to change the base?
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## dev #2338 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 183 183
Lines 2249 2142 -107
Branches 636 566 -70
==========================================
- Hits 2249 2142 -107
☔ View full report in Codecov by Sentry. |
after careful thought, the main issue leading to this bug is not related to the display dayjs.duration({ minutes: 359 }).toJSON() should return "PT5H59M" rather than ""PT359M"" that is to say, you can try to move your calc logic to https://github.com/iamkun/dayjs/blob/dev/src/plugin/duration/index.js#L78 that will make the getter and setter both correct. ps: IMHO, you have made a nice refactor to the test cases. However, it will be better to keep all the existing test cases to make the lib stronger. Any new PRs should only add new cases or modify the error cases. 😀 |
after checking the PR again, still I think, we should update the input part (setter and the constructor) to make the inner data correct, not in the output part What do you think then? |
fix #2329