Bootstap datetimepicker error TypeError: intermediate value

Source: Internet
Author: User

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:

  1. TypeError: (intermediate value). toString (...). split (...) [1] is undefined


  2. ... D "? False: k. title; this. defaultTimeZone = (new Date (). toString (). split ("(

Original article:

  1. 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:
  1. 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:

  1. This. fontAwesome = k. fontAwesome | this. element. data ("font-awesome") | false;
Changed:
  1. This. fontAwesome = true



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.