-
Notifications
You must be signed in to change notification settings - Fork 7k
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
Garbage input to setter fix #3486
Conversation
Sorry, this isn't good enough. It needs to actually test the |
So basically, You don't want the setter to set the illegal value and then check whether the instance is valid or not right? You want to prompt at the setter itself, by checking the value? |
Correct. On Mon, Oct 10, 2016 at 8:12 PM, Mayank Badola notifications@github.com
|
Just a minor doubt. Is there a method in moment to check for the validity of an input as an year, month etc.? |
It really need only be numeric. The setters will all overflow into the next On Mon, Oct 10, 2016 at 10:55 PM, Mayank Badola notifications@github.com
|
Hi! I've identified where to change the code. Just need to know how do you need the rejection of illegal input to be handled. Silently ignore it or do something else? Please let me know @mj1856 @maggiepint Thanks :) |
@mbad0la like everything else in moment -- we silently ignore errors. If its the constructor then you can make the moment invalid. If its a setter, just ignore the error. |
I used this information and added a |
@@ -4,7 +4,7 @@ import getParsingFlags from '../create/parsing-flags'; | |||
import some from '../utils/some'; | |||
|
|||
export function isValid(m) { | |||
if (m._isValid == null) { | |||
if (m._isValid === null || m._isValid === true) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changes validity evaluation from one to continual. I don't see why this change would need to cause that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, this change is causing that.
Closing in favor of #3704 |
Work in Progress
Hi @mj1856 @maggiepint
This PR is in reference to #3483
Please review the current changes and let me know if this hack seems to be doing the trick. Also, let me know of any other steps I need to take to make this PR ready for a merge. Thanks :)