tempusdominus / bootstrap-4

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

Errors for particular dates #294

Open josefsabl opened 4 years ago

josefsabl commented 4 years ago

This is as far as I could get with jsfiddle but it, unfortunately, doesn't exhibit the problem. What are we doing wrong? Our version is: 5.1.2

When there is a particular date, the plugin just collapses.

<input 
  type="text" 
  name="publishedAt" 
  id="frm-form-publishedAt" 
  value="15.01.2009 00:00:00"
  class="form-control  js-datetimepicker datetimepicker-input"
  data-date-format="DD.MM.YYYY HH:mm:ss"
  data-toggle="datetimepicker"
  data-target="#frm-form-publishedAt"
  autocomplete="off"
>

The data attributes are passed to datepicker as options date and format as demonstrated in fiddle.

Interestingly, the textual representation of the date above is changed after initializing the plugin to: 20.09.2001 15:00:00 See the similarity of the dates? I guess the plugin does the parsing wrong.

The aforementioned snippet works if year is changed to 2019.

Also changing the format to MMM DD, YYYY hh:mm:ss a makes the errors to go away and calendar works.

Looks like MM token in format is causing the trouble.

Error on init:

vendors~bootstrap~co…5d6338a0.chunk.js:2 Uncaught (in promise) SyntaxError: Invalid regular expression: /(^|\.)datetimepicker(\.|$)/: Stack overflow
    at RegExp.test (<anonymous>)
    at HTMLDocument.dispatch (vendors~bootstrap~co…5d6338a0.chunk.js:2)
    at HTMLDocument.v.handle (vendors~bootstrap~co…5d6338a0.chunk.js:2)
    at Object.trigger (vendors~bootstrap~co…5d6338a0.chunk.js:2)
    at HTMLInputElement.<anonymous> (vendors~bootstrap~co…5d6338a0.chunk.js:2)
    at Function.each (vendors~bootstrap~co…5d6338a0.chunk.js:2)
    at C.fn.init.each (vendors~bootstrap~co…5d6338a0.chunk.js:2)
    at C.fn.init.trigger (vendors~bootstrap~co…5d6338a0.chunk.js:2)
    at o.M._notifyEvent (vendors~dateTimePick…556b2ee5.chunk.js:2)
    at o.M._setValue (vendors~dateTimePick…556b2ee5.chunk.js:2)

Errors on focus:

Uncaught TypeError: Cannot read property '_options' of undefined
    at HTMLInputElement.<anonymous> (vendors~dateTimePick…556b2ee5.chunk.js:2)
    at HTMLDocument.dispatch (vendors~bootstrap~co…5d6338a0.chunk.js:2)
    at HTMLDocument.v.handle (vendors~bootstrap~co…5d6338a0.chunk.js:2)
    at Object.trigger (vendors~bootstrap~co…5d6338a0.chunk.js:2)
    at Object.simulate (vendors~bootstrap~co…5d6338a0.chunk.js:2)
    at HTMLDocument.n (vendors~bootstrap~co…5d6338a0.chunk.js:2)

Uncaught SyntaxError: Invalid regular expression: /(^|\.)datetimepicker(\.|$)/: Stack overflow
    at RegExp.test (<anonymous>)
    at HTMLDocument.dispatch (vendors~bootstrap~co…5d6338a0.chunk.js:2)
    at HTMLDocument.v.handle (vendors~bootstrap~co…5d6338a0.chunk.js:2)
    at Object.trigger (vendors~bootstrap~co…5d6338a0.chunk.js:2)
    at HTMLInputElement.<anonymous> (vendors~bootstrap~co…5d6338a0.chunk.js:2)
    at Function.each (vendors~bootstrap~co…5d6338a0.chunk.js:2)
    at C.fn.init.each (vendors~bootstrap~co…5d6338a0.chunk.js:2)
    at C.fn.init.trigger (vendors~bootstrap~co…5d6338a0.chunk.js:2)
    at o.M._notifyEvent (vendors~dateTimePick…556b2ee5.chunk.js:2)
    at o.M._setValue (vendors~dateTimePick…556b2ee5.chunk.js:2)

Error on losing focus:

Uncaught TypeError: Cannot read property '_options' of undefined
    at HTMLInputElement.<anonymous> (vendors~dateTimePick…556b2ee5.chunk.js:2)
    at HTMLDocument.dispatch (vendors~bootstrap~co…5d6338a0.chunk.js:2)
    at HTMLDocument.v.handle (vendors~bootstrap~co…5d6338a0.chunk.js:2)
    at Object.trigger (vendors~bootstrap~co…5d6338a0.chunk.js:2)
    at Object.simulate (vendors~bootstrap~co…5d6338a0.chunk.js:2)
    at HTMLDocument.n (vendors~bootstrap~co…5d6338a0.chunk.js:2)
josefsabl commented 4 years ago

Probably related: https://github.com/tempusdominus/bootstrap-4/issues/30