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

Fix add(Duration) bug. #2426

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open

Fix add(Duration) bug. #2426

wants to merge 1 commit into from

Conversation

mlkt
Copy link

@mlkt mlkt commented Aug 24, 2023

Fix #2425.
Verify whether value is valid before calculating.

@mlkt mlkt changed the title Fix add(Duration) bug. #2425 Fix add(Duration) bug. Aug 24, 2023
@iamkun
Copy link
Owner

iamkun commented Sep 19, 2023

That sweet fix, thanks

can you add some unit cases to make the CI pass, please?

@iamkun
Copy link
Owner

iamkun commented Sep 21, 2023

we have another fix here #2369, might have fixed this issue as well?

@mlkt
Copy link
Author

mlkt commented Sep 23, 2023

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
Copy link

codecov bot commented Oct 3, 2023

Codecov Report

All modified lines are covered by tests ✅

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%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

Successfully merging this pull request may close these issues.

add(Duration) or subtract(Duration) in version v1.11.9 is invalid.
2 participants