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
date validation before setting it #64
Comments
Can you show me the code? |
Sure, here you are: http://jsbin.com/siyecocoja |
Also having this problem. It looks like this happens when the input field starts blank, and then a user provides an invalid date. If you give the input field a valid initial date, it will "revert" to the previous date if a user tries to type something invalid. |
Okay, so, technically what Rome is doing isn't wrong. As you type, Rome parses This is, however, not a bug. |
Well, it is not a bug, but it would be better to give a hook to validate given inputs. I did not find something like that. Setting a If you give me a hint on where to start, I could implement it. |
The problem is that: moment('12.3', 'DD.MM.YYYY').isValid()
// <- true
moment('12.3', 'DD.MM.YYYY', true).isValid()
// <- false
moment('12.30.1980', 'DD.MM.YYYY', true).isValid()
// <- false
moment('12.03.1980', 'DD.MM.YYYY', true).isValid()
// <- true |
I would create an option for strict date validation, and then make it the default in a later version. |
Using an input format like
DD.MM.YYYY
and setting the date to something like12.30.1980
the calendar will compute it as12.01.0000
.Is there a way to validate the given date before using it? I would expect something like
moment(input, 'DD.MM.YYYY').isValid()
before computing the thing.The text was updated successfully, but these errors were encountered: