Bootstap datetimepicker error TypeError: intermediate value
Bootstrap datetimepicker has multiple versions. In the official link, it is only a datepicker. If there is no time option, the original datetimepicker will not be updated and the new version of jquery cannot be used.
Now begin;
Https://github.com/smalot/bootstrap-datetimepickeris still correct, but it is easy to use.
Error:
- TypeError: (intermediate value). toString (...). split (...) [1] is undefined
- ... D "? False: k. title; this. defaultTimeZone = (new Date (). toString (). split ("(
Original article:
- This. defaultTimeZone = (new Date (). toString (). split ("(") [1]. slice (0,-1 );
Meaning: first obtain the Date object, then stringize it, then use (to separate the string, then take the second one, and then take the first item from the right to the left, that is, take the time zone.
However, in Firefox, The stringized result is: "Wed May 25 2016 16:07:14 GMT + 0800" without parentheses, resulting in an error.
In more general cases, you can use getTimezoneOffset () to obtain the time zone. The unit of the result is minute. Therefore, you can divide it by 60:
To:
- This. defaultTimeZone = 'gmt' + (new Date (). getTimezoneOffset ()/60
After modification, it can be used normally.
There is also a font error. If the fa font is used, an error will be reported. The system will not detect fontAwesome, so you can directly assign this variable to true:
- This. fontAwesome = k. fontAwesome | this. element. data ("font-awesome") | false;
Changed:
- This. fontAwesome = true