Reputation: 343
I have an input element on my form that accepts a date/time. It has validation to check that it's a valid date/time. The default value for the field is the current date and time. When using Chrome, I can change the value of this input box multiple times, and as long as it is a valid date and time it will be accepted. However, in IE 11, if I change it to another valid date/time, it indicates an invalid value and will not allow the form to save.
The date/time field:
input#transit_date_arrived.form-control.date-time-picker(name='transit_date_arrived', ng-model='vehicle.transit_date_arrived', type='datetime')
In the vehicle model:
transit_date_arrived: {
type: sequelize.DATE,
allowNull: true,
validate: {
isDate: true
}
},
If anyone knows how to get this to work with Internet Explorer, I would really appreciate it, thanks!
Upvotes: 0
Views: 3159
Reputation: 970
One problem with IE and angularJS (in fact, maybe more than just a.JS) is that a field marked as invalid
also spontaneously becomes "dirty" when typed in, tabbed through or otherwise interacted with. Apparently this also applies when validation resets the field, and on the second interaction the same happens.
According to a few questions and a bit of research, validation is actually very broken in IE. At this link, for example, determination between literal empty strings and invalid strings in impossible.
This link shows some issues that the author has come across in actual date verification, including error handling and false-date resolution. Unfortunately, his code has broken the definition for a "true" date - i.e. 0000.00.00 would be recognised as a valid date, due only to it's formatting.
There is an example of date verification here, which you may wish to use to append your code. in particular, you may wish to use $valid
and $error.required
.
There's also a very ugly piece of code here, which intends to allow validation in 4-step form.
Upvotes: 1