Home > Backend Development > PHP Tutorial > Bootstap datetimepicker reports TypeError: intermediate value_PHP tutorial

Bootstap datetimepicker reports TypeError: intermediate value_PHP tutorial

WBOY
Release: 2016-07-12 08:51:39
Original
1112 people have browsed it

Bootstrap datetimepicker reports TypeError: intermediate value

Bootstrap datetimepicker has multiple versions. In the official link, it is just datepicker without time selection. The original datetimepicker is no longer updated and the new version cannot be used. jquery.
Now https://github.com/Eonasdan/bootstrap-datetimepicker is the most complete version, but a lot of dependencies are a headache;
https://github.com/smalot/bootstrap-datetimepicker is not bad, compare Lightweight, but error-prone when used.

Error:

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


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

Original text:

  1. this.defaultTimeZone=(new Date()).toString().split("(") [1].slice(0,-1);
means: first get the Date object, then stringify it, then use ( to separate the string, and then take the second one , and then take the first item from right to left, that is, the time zone item
But in Firefox, the stringification result is: "Wed May 25 2016 16:07:14 GMT 0800" without brackets, resulting in Error.

More generally, the time zone can be obtained using getTimezoneOffset(). The unit of this result is minutes, so it needs to be divided by 60:
Modified to:
  1. this.defaultTimeZone='GMT ' (new Date()).getTimezoneOffset()/60

After modification, it can be used normally.
There is also a font error. If you use the fa font, an error will be reported and fontAwesome will not be detected in the system, so you can directly assign this variable to true:



this .fontAwesome=k.fontAwesome||this.element.data("font-awesome")||false;
  1. is changed to:
this.fontAwesome=true



http://www.bkjia.com/PHPjc/1129195.html

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1129195.htmlTechArticleBootstap datetimepicker reports TypeError: intermediate value Bootstrap datetimepicker has multiple versions. In the official link, it is just datepicker without time. The choice, the original dateti...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template