当我使用配置生成器代码时,所有内容都显示无效日期
Invalid date is appearing for everything when I use Configuration Generator code
使用 http://www.daterangepicker.com/#examples 中的配置生成器,我选择了 "ranges (with example predefined ranges)" 并获得了以下 JS:
$('#demo').daterangepicker({
"ranges": {
"Today": [
"2016-10-17T04:27:01.501Z",
"2016-10-17T04:27:01.501Z"
],
"Yesterday": [
"2016-10-16T04:27:01.501Z",
"2016-10-16T04:27:01.501Z"
],
"Last 7 Days": [
"2016-10-11T04:27:01.501Z",
"2016-10-17T04:27:01.501Z"
],
"Last 30 Days": [
"2016-09-18T04:27:01.501Z",
"2016-10-17T04:27:01.501Z"
],
"This Month": [
"2016-10-01T05:00:00.000Z",
"2016-11-01T04:59:59.999Z"
],
"Last Month": [
"2016-09-01T05:00:00.000Z",
"2016-10-01T04:59:59.999Z"
]
},
"startDate": "10/10/2016",
"endDate": "10/16/2016"
}, function(start, end, label) {
console.log("New date range selected: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD') + ' (predefined range: ' + label + ')");
});
不幸的是,当我使用它时,每个日期都是无效的。这是一个 JS fiddle 演示我的意思:
https://jsfiddle.net/LgetLa6c/
如果您将鼠标悬停在任何内容上,它会显示 "Invalid date"。唯一没有说 "Invalid date" 的是 "Custom Range".
我明白了。日期需要格式化为 "10/17/2016"
.
而不是像 "2016-10-17T04:27:01.501Z"
这样的日期格式
文档中的示例不起作用这一事实非常愚蠢。
使用 http://www.daterangepicker.com/#examples 中的配置生成器,我选择了 "ranges (with example predefined ranges)" 并获得了以下 JS:
$('#demo').daterangepicker({
"ranges": {
"Today": [
"2016-10-17T04:27:01.501Z",
"2016-10-17T04:27:01.501Z"
],
"Yesterday": [
"2016-10-16T04:27:01.501Z",
"2016-10-16T04:27:01.501Z"
],
"Last 7 Days": [
"2016-10-11T04:27:01.501Z",
"2016-10-17T04:27:01.501Z"
],
"Last 30 Days": [
"2016-09-18T04:27:01.501Z",
"2016-10-17T04:27:01.501Z"
],
"This Month": [
"2016-10-01T05:00:00.000Z",
"2016-11-01T04:59:59.999Z"
],
"Last Month": [
"2016-09-01T05:00:00.000Z",
"2016-10-01T04:59:59.999Z"
]
},
"startDate": "10/10/2016",
"endDate": "10/16/2016"
}, function(start, end, label) {
console.log("New date range selected: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD') + ' (predefined range: ' + label + ')");
});
不幸的是,当我使用它时,每个日期都是无效的。这是一个 JS fiddle 演示我的意思:
https://jsfiddle.net/LgetLa6c/
如果您将鼠标悬停在任何内容上,它会显示 "Invalid date"。唯一没有说 "Invalid date" 的是 "Custom Range".
我明白了。日期需要格式化为 "10/17/2016"
.
"2016-10-17T04:27:01.501Z"
这样的日期格式
文档中的示例不起作用这一事实非常愚蠢。