angular-eonasdan-datetimepicker
angular-eonasdan-datetimepicker copied to clipboard
Manually entered dates issues
I use format 'YYYY-MM-DD' option and bind ng-model="formData.date" to my field. Now if I enter '2015-03-05aaaaa', the date is displayed as '2015-03-05', but my $scope.formData.date becomes '2015-03-05aaaaa'. So even if I write error message to user that date is invalid, in input field it looks like totally valid value '2015-03-05' (even though $scope.formData.date is not valid). How do I stop datetimepicker from automatically correcting my dates? this misleads users.
Well...
The only solution I could think of is that the wrapper should parse the input first. This feature is missing.
But maybe there is an easier option. Did you find any solution? I am not actively developing this wrapper anymore.
In order to achieve this a few things need to be done.
-
Use the following options for the date time picker keepInvalid: true, useStrict: true Options Reference Example Fiddle
-
With those settings applied, entering such a type of data, the current version of the library goes into a infinite digest loop, and bogs down the page without resolving it properly. (caused by not checking if the moment objects are valid). This should be fixed in my fork, and I am working to submit a pull request.