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

[bugfix] Handle invalid mutations #5554

Closed
wants to merge 4 commits into from
Closed

Conversation

Alanscut
Copy link
Contributor

@Alanscut Alanscut commented May 20, 2020

fixes issue #5075

Summary

Add and substract can change the original moment, moment._ Isvalid should change synchronously.

Test plan

src/test/moment/is_valid.js

@coveralls
Copy link

coveralls commented May 20, 2020

Coverage Status

Coverage increased (+0.004%) to 88.489% when pulling 9ab2dc2 on Alanscut:issue_5075 into a0f3c74 on moment:develop.

@marwahaha marwahaha requested a review from ichernev May 20, 2020 09:36
Copy link
Member

@marwahaha marwahaha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will recompute isValid every time it runs.
Perhaps could we compute _isValid whenever the moment object is mutated?
@ichernev may also have input.

(!flags.meridiem || (flags.meridiem && parsedParts));

var flags = null,
parsedParts = false,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure we have to assign these; could we do

var flags,
  parsedParts,
  isNowValid = ...

@ichernev
Copy link
Contributor

Merged in 5718d97

@ichernev ichernev closed this Dec 23, 2023
ichernev added a commit that referenced this pull request Dec 23, 2023
[bugfix] Fix issue #5075, Delete destructive judgment
@ichernev ichernev changed the title [bugfix] Fix issue #5075, Delete destructive judgment [bugfix] Handle invalid mutations Dec 26, 2023
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.

None yet

4 participants