jQuery("#list_table").on("click",".datetime-picker-click", function(ev){
var el = jQuery(ev.target).parent().find('.datetime-picker');
el.periodpicker({
norange: true,
// buttonClassSuffix: 'hidden'
likeXDSoftDateTimePicker:true,
timepicker: true,
formatDate: convertMyDateFormatStringToMomentsString(dateformat),
formatDateTime: convertMyDateFormatStringToMomentsString(datetimeformat),
lang: _twoletterlangid,
timepickerOptions: {
ampm: (datetimeformat.indexOf('%p')>=0),
twelveHoursFormat: (datetimeformat.indexOf('%p')>=0)
},
todayButton: true,
onOkButtonClick: function () {
//some code
},
onAfterHide: function () {
var val = this.startinput.val();
if (!val || !moment(val, this.options.format).isValid()) {
this.addRange([new Date()]);
}
}
});
el.periodpicker('show');
ev.preventDefault();
});
The above code causes this error:
raven.js:437 Uncaught TypeError: Cannot read property 'length' of undefined
at b (jquery.periodpicker.full.min.js:14)
at q (jquery.periodpicker.full.min.js:14)
at new e (jquery.periodpicker.full.min.js:15)
at HTMLInputElement.<anonymous> (jquery.periodpicker.full.min.js:15)
at Function.each (jquery.min.js:2)
at a.fn.init.each (jquery.min.js:2)
at a.fn.init.a.fn.periodpicker (jquery.periodpicker.full.min.js:15)
at HTMLAnchorElement.<anonymous> (ws_task.list.js?v=1522327133:764)
at HTMLTableSectionElement.dispatch (jquery.min.js:3)
at HTMLTableSectionElement.q.handle (jquery.min.js:3)
at HTMLTableSectionElement.d (raven.js:433)
Without onAfterHide code all work fine
jQuery PeriodPicker plugin v6.1.8
Google Chrome 65.0.3325.181
jQuery 3.0.0.
The above code causes this error:
Without onAfterHide code all work fine
jQuery PeriodPicker plugin v6.1.8 Google Chrome 65.0.3325.181 jQuery 3.0.0.