Bootstap datetimepicker报错TypeError: intermediate value(转)
原文转自:http://blog.chinaunix.net/uid-20332519-id-5733546.html
Bootstrap datetimepicker有多个版本,官方的链接中,只是datepicker,没有时间的选择,原版的datetimepicker也不再更新,不能用新版的jquery。
现在https://github.com/Eonasdan/bootstrap-datetimepicker这个版本最完善,但是一大堆依赖很头疼;
https://github.com/smalot/bootstrap-datetimepicker还不错,比较轻巧,但是用起来报错。
报错:
TypeError: (intermediate value).toString(...).split(...)[] is undefined
...d"?false:k.title;this.defaultTimeZone=(new Date()).toString().split("(
原文:
this.defaultTimeZone=(new Date()).toString().split("(")[1].slice(0,-1);
意思为:先取得Date对象,然后再字符串化,再用(来分隔字符串,然后取其中的第二个,再从右向左取第一项,也就是取时区项。
但在Firefox中,字符串化的结果为:“Wed May 25 2016 16:07:14 GMT+0800”,没有括号,导致错误。
更为通用的,时区可以用getTimezoneOffset()来获取,这个结果的单位是分钟,所以要除以60才可以:
修改为:
this.defaultTimeZone='GMT '+(new Date()).getTimezoneOffset()/60
修改后就可以正常使用了。
this.fontAwesome=k.fontAwesome||this.element.data("font-awesome")||false;
改为:
this.fontAwesome=true
另外还有一个字体错误,如果使用了fa字体,则会报错,系统中会检测不到fontAwesome,所以可以直接赋这个变量为true:
Bootstap datetimepicker报错TypeError: intermediate value(转)的更多相关文章
- Bootstap datetimepicker报错TypeError: intermediate value
Bootstrap datetimepicker有多个版本,官方的链接中,只是datepicker,没有时间的选择,原版的datetimepicker也不再更新,不能用新版的jquery.现在http ...
- [转载]UEditor报错TypeError: me.body is undefined
本文转载来自:UEditor报错TypeError: me.body is undefined 今天在使用UEditor的setContent的时候报错,报错代码如下 TypeError: me.bo ...
- appium 提示报错“TypeError: 'unicode' object is not callable”的解决方式!
这里提到的这个报错,是小错误且容易经常会犯,有时需要特别注意使用. 目的要求结果:根据某个元素的id值获取到对应id的text值,并且将获取的text值与本身存在的text值做比较,查看text值是否 ...
- VUE.JS 使用axios数据请求时数据绑定时 报错 TypeError: Cannot set property 'xxxx' of undefined 的解决办法
正常情况下在data里面都有做了定义 在函数里面进行赋值 这时候你运行时会发现,数据可以请求到,但是会报错 TypeError: Cannot set property 'listgroup' of ...
- python报错 TypeError: a() got multiple values for argument 'name'
[问题现象] 在一次调用修饰函数中出现了问题,折腾了一下午,一直报错 TypeError: got multiple values for argument 只是很简单的调用 from tsu2Ru ...
- firefox浏览器中使用vux的x-input报错TypeError: _this3.$refs.input.scrollIntoViewIfNeeded is not a function
最近做公众号项目,想着统一风格,所以决定使用vux. 在调试时发现,只要鼠标点击x-input输入框,就会报错 TypeError: _this3.$refs.input.scrollIntoView ...
- Node中使用MySQL报错:TypeError: Cannot read property 'query' of undefined
Node中使用MySQL报错: TypeError: Cannot read property 'query' of undefined at /Users/sipeng/Desktop/彭思/201 ...
- 完美解决 scipy.misc.imread 报错 TypeError: Image data cannot be converted to float
File "/home/harrison/anaconda3/lib/python3.7/site-packages/matplotlib/image.py", line 634, ...
- 关于Jupyter Notebook无法自动补全(Autocompletion),报错TypeError: __init__() got an unexpected keyword argument 'column' 的解决方案
关于Jupyter Notebook无法自动补全(Autocompletion),报错TypeError: __init__() got an unexpected keyword argument ...
随机推荐
- 【matlab】查看程序运行时间
程序开头 profile on 结尾 profile viewer 然后就会很贴心滴出现下面的界面,可以从中展开,查看每段运行的时间
- centos7中 npm install express 时Error: Cannot find module 'express'错误
费了很大劲最后在网上找到,在自己的工程目录下再次执行npm install express搞定.
- investopedia level 2
Mispricing can be explained by the sum of the two components: true mispricing and estimation errorVe ...
- MongoDB搭建Replica Set Shard Cluster步骤
本文记录从头搭建一个MongoDB 副本集分片集群的过程. 我们要创建一个这样子的分布式集群:有两个shard,每个shard都是一个replica set,各有两个副本(实际产品应用中还应加上一个仅 ...
- 什么是 jsonp ?
浏览器不支持Ajax跨域请求 但能加载任何地方的外部js文件 jsonp就是借用这个特点 通过引入文件拿到想要的数据 而不是通过AJAX请求 假如你想获取 vcico.com 的 $data ...
- c# windows编程控件学习-2
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...
- Wince 6.0 窗口最大化显示
在InitDialog用如下代码实现: CRect m_FullScreenRect; //全屏区域 CRect WindowRect; GetWindowRect(&Window ...
- shell多行注释
:<<BLOCK ....被注释的多行内容 BLOCK :<< 'BLOCK ....被注释的多行内容 BLOCK'
- scanf()读取带空格的字符串
#include <stdio.h> int main() { char str[128]; scanf( "%[^\n]", str ); printf( " ...
- hadoop map-red的执行过程
hadoop的 map-red就是一个并行计算平台,我们在使用这个平台的时候,要做的事情就是提交自己定制的任务(job,主要定制map类,reduce类,combine类等类),然后设置job的各种参 ...