tempusdominus / bootstrap-4

Tempus Dominus Bootstrap 4 Datetime Picker
https://getdatepicker.com/5-4/
MIT License
611 stars 239 forks source link

Uncaught TypeError when exiting input with bad value #356

Open mscomparin opened 4 years ago

mscomparin commented 4 years ago

Opening the calendar with no value on the input tag when you enter a bad date and focus out the field, an Uncaught TypeError is raised.

You can reproduce the issue following the steps below.

  1. Click on the calendar icon.
  2. Remove the generated date from the input with the calendar opened.
  3. Enter a bad date (eg. "asdaffhsakfasdfhsafh").
  4. Click outside the input to close the calendar.

This is the stack-trace in the console of the browser(F12, not the little one on the page that just shows <a class='gotoLine' href='#402:25] TypeError: this._dates[index'>402:25] TypeError: this._dates[index</a> is undefined) when I get the error on the jsfiddle you provided (see CONTRIBUTING.md) https://jsfiddle.net/Eonasdan/bdxss6m8/:

Uncaught TypeError: this._dates[index] is undefined
    _setValue https://rawgit.com/tempusdominus/bootstrap-4/master/build/js/tempusdominus-bootstrap-4.js:472
    _change https://rawgit.com/tempusdominus/bootstrap-4/master/build/js/tempusdominus-bootstrap-4.js:493
    _jQueryHandleThis https://rawgit.com/tempusdominus/bootstrap-4/master/build/js/tempusdominus-bootstrap-4.js:2699
    _jQueryInterface https://rawgit.com/tempusdominus/bootstrap-4/master/build/js/tempusdominus-bootstrap-4.js:2706
    TempusDominusBootstrap4 https://rawgit.com/tempusdominus/bootstrap-4/master/build/js/tempusdominus-bootstrap-4.js:2734
    jQuery 8
        dispatch
        handle
        add
        on
        each
        each
        on
        on
    TempusDominusBootstrap4 https://rawgit.com/tempusdominus/bootstrap-4/master/build/js/tempusdominus-bootstrap-4.js:2729
    <anonymous> https://rawgit.com/tempusdominus/bootstrap-4/master/build/js/tempusdominus-bootstrap-4.js:2777
    <anonymous> https://rawgit.com/tempusdominus/bootstrap-4/master/build/js/tempusdominus-bootstrap-4.js:2779
tempusdominus-bootstrap-4.js:472:25