插入 ISO 数据后 mongoDB 中的数据无效
Invalid data in mongoDB after insert of an ISO data
我尝试在 jquery 全日历中存储基于 dayClick 事件的记录。根据控制台日志,日期提供为:
locale: Object, _d: Date 2015-03-19T00:00:00.000Z, 然后我在检查数据库时将它传递给 ce.start 和 ce.end我在 calevnt.start 和 calevent.end 中有 'Invalid date' 作为值 --- 这里有什么问题?
在客户端:
Template.calendar.helpers({
options: function() {
return {
lang: 'de',
dayClick:function(date,allDay,jsEvent,view){
var ce = {};
ce.start = date;
ce.end = date;
ce.color = 'red';
ce.className = 'todo';
ce.project = Session.get('active_project');
ce.title = ' Jour Fixe2';
ce.owner = Meteor.userId;
console.log(date,allDay,jsEvent,view);
Meteor.call('addCalEvent',ce);
}
}
}
});
在服务器上:
'addCalEvent': function (calevent) {
if (!calevent.type) {
calevent.type = 'milestone';
}
return Calevents.insert(calevent);
},
尝试
Template.calendar.helpers({
options: function() {
return {
selectable: true,
selectHelper: true,
lang: 'de',
select: function(start, end, allDay) {
var ce = {};
ce.start = start.format(); // return moment date
ce.end = end.format(); // return moment date
ce.color = 'red';
ce.className = 'todo';
ce.project = Session.get('active_project');
ce.title = ' Jour Fixe2';
ce.owner = Meteor.userId;
console.log(start, end);
Meteor.call('addCalEvent',ce);
}
}
}
});
我尝试在 jquery 全日历中存储基于 dayClick 事件的记录。根据控制台日志,日期提供为: locale: Object, _d: Date 2015-03-19T00:00:00.000Z, 然后我在检查数据库时将它传递给 ce.start 和 ce.end我在 calevnt.start 和 calevent.end 中有 'Invalid date' 作为值 --- 这里有什么问题?
在客户端:
Template.calendar.helpers({
options: function() {
return {
lang: 'de',
dayClick:function(date,allDay,jsEvent,view){
var ce = {};
ce.start = date;
ce.end = date;
ce.color = 'red';
ce.className = 'todo';
ce.project = Session.get('active_project');
ce.title = ' Jour Fixe2';
ce.owner = Meteor.userId;
console.log(date,allDay,jsEvent,view);
Meteor.call('addCalEvent',ce);
}
}
}
});
在服务器上:
'addCalEvent': function (calevent) {
if (!calevent.type) {
calevent.type = 'milestone';
}
return Calevents.insert(calevent);
},
尝试
Template.calendar.helpers({
options: function() {
return {
selectable: true,
selectHelper: true,
lang: 'de',
select: function(start, end, allDay) {
var ce = {};
ce.start = start.format(); // return moment date
ce.end = end.format(); // return moment date
ce.color = 'red';
ce.className = 'todo';
ce.project = Session.get('active_project');
ce.title = ' Jour Fixe2';
ce.owner = Meteor.userId;
console.log(start, end);
Meteor.call('addCalEvent',ce);
}
}
}
});