Fix add(Duration) bug.
Fix #2425. Verify whether value is valid before calculating.
That sweet fix, thanks
can you add some unit cases to make the CI pass, please?
we have another fix here https://github.com/iamkun/dayjs/pull/2369, might have fixed this issue as well?
Yes. Your fix is to change the Falsy value returned by the get to 0, and my one is that when the Falsy value is found during calculation, no addition or subtraction is performed. Both of them can solve the problem of calculation error, and it is suggested to merge them.
你这个是把get的时候返回的Falsy值变成0,我的这个是计算时发现是Falsy值则不进行加减,都可以解决计算错误的问题,建议可以都合并。
Codecov Report
All modified lines are covered by tests :white_check_mark:
Comparison is base (
a947a51) 99.77% compared to head (1d3d0a9) 99.77%.
Additional details and impacted files
@@ Coverage Diff @@
## dev #2426 +/- ##
=======================================
Coverage 99.77% 99.77%
=======================================
Files 183 183
Lines 2262 2272 +10
Branches 641 643 +2
=======================================
+ Hits 2257 2267 +10
Misses 5 5
| Files | Coverage Δ | |
|---|---|---|
| src/plugin/duration/index.js | 100.00% <100.00%> (ø) |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.