bootstrap-datetimepicker
bootstrap-datetimepicker copied to clipboard
Uncaught TypeError: Cannot read property 'getTime' of undefined
I am using this only as Time picker with format HH:ii P
but when I dynamically change its value it throws this error
bootstrap-datetimepicker.min.js:formatted:431 Uncaught TypeError: Cannot read property 'getTime' of undefined
at getDate (bootstrap-datetimepicker.min.js:formatted:431)
at g.update (bootstrap-datetimepicker.min.js:formatted:624)
at g.setStartDate (bootstrap-datetimepicker.min.js:formatted:497)
at new g (bootstrap-datetimepicker.min.js:formatted:315)
at HTMLInputElement.<anonymous> (bootstrap-datetimepicker.min.js:formatted:1432)
at Function.each (jquery-2.1.3.min.js:2)
at n.fn.init.each (jquery-2.1.3.min.js:2)
at n.fn.init.d.fn.datetimepicker (bootstrap-datetimepicker.min.js:formatted:1427)
at <anonymous>:1:3
getDate @ bootstrap-datetimepicker.min.js:formatted:431
update @ bootstrap-datetimepicker.min.js:formatted:624
setStartDate @ bootstrap-datetimepicker.min.js:formatted:497
g @ bootstrap-datetimepicker.min.js:formatted:315
(anonymous) @ bootstrap-datetimepicker.min.js:formatted:1432
each @ jquery-2.1.3.min.js:2
each @ jquery-2.1.3.min.js:2
d.fn.datetimepicker @ bootstrap-datetimepicker.min.js:formatted:1427
(anonymous) @ VM4937:1
Show 2 more blackboxed frames
When I inspected the error I found that this.date
is undefined, Which is returned by getUTCDate
Method
...
getDate: function() {
var i = this.getUTCDate();
if (i === null) {
return null
}
return new Date(i.getTime() + (i.getTimezoneOffset() * 60000))
},
getUTCDate: function() {
return this.date
},
...
Thanks
Can you provide a jsfiddle to illustrate this? https://jsfiddle.net/AuspeXeu/sqwwcjzu/
OK Done
$("#dtp").datetimepicker({
startView: 'day',
format: 'HH:ii p'
});
Do you have you full code and could you please fork the jsfiddle and paste the link of an example here?
Here it is https://jsfiddle.net/shishtpal/k2o5sn1q/