angular-eonasdan-datetimepicker icon indicating copy to clipboard operation
angular-eonasdan-datetimepicker copied to clipboard

Manually entered dates issues

Open Dancia opened this issue 8 years ago • 2 comments

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.

Dancia avatar May 11 '17 14:05 Dancia

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.

atais avatar May 16 '17 07:05 atais

In order to achieve this a few things need to be done.

  1. Use the following options for the date time picker keepInvalid: true, useStrict: true Options Reference Example Fiddle

  2. 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.

CapitanMorgan avatar Jun 23 '17 07:06 CapitanMorgan