问题描述
我正在使用fullcalendar,除了调用JSON序列化数据之后,一切看起来都不错.日期格式如"6月29日星期三"等,变为开始:{}",这不是我所需要的.我想念什么?
知道为什么将日期变成{}吗?
这是脚本:
I''m using fullcalendar and everything looks good except after calling toJSON to serialize the data. The dates, which are formatted like "Wed 29, June" etc., becomes "start: {}" which is not what I need. What am I missing?
Any idea why it''s turning date''s into {}?
Here is the script:
// first the calendar
$(document).ready(function() {
$('#calendar').fullCalendar({
dayClick: function(date, allDay, jsEvent, view) {
$(this).css('background-color', 'red');
},
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
aspectRatio: 1.5,
editable: true,
events: "/Calendar/CalendarData"
});
});
日期在事件中看起来不错,但是在toJSON调用之后,日期被转换为{}.
这是toJSON调用:
The date looks good in the event, but after toJSON call, the dates get converted to {}.
Here is the toJSON call:
var event = $('#calendar').fullCalendar('clientEvents');
var jlst = $.toJSON(event);
$.post("/Calendar/AddCalendar", { jsonData: jlst },
function(data, textStatus) {
if (textStatus != "success") {
result = "false";
}
});
在调用toJSON之前,日期如下所示:
Here is what the date looks like before call to toJSON:
"Wed Jun 23 2010 06:00:00 GMT-0400 (Eastern Daylight Time) {}"
这是序列化的数据.请注意开始和结束字段已更改:
Here is the serialized data. Note the start and end fields have changed:
"[{\"id\":\"69cf0853-40e3-4d29-8dc6-9d8b83e9696d\",
\"title\":\"Second Schedule",
\"start\":{},
\"end\":{},
\"allDay\":false,
\"_id\":\"69cf0853-40e3-4d29-8dc6-9d8b83e9696d\",
\"_start\":{},
\"_end\":{},
\"className\":[],
\"source\":\"/Calendar/CalendarData\"}]"
任何提示将不胜感激.谢谢.
Any tips will be much appreciated. Thanks.
推荐答案
日期在事件中看起来不错,但是在toJSON调用之后,日期被转换为{}.
这是toJSON调用:
The date looks good in the event, but after toJSON call, the dates get converted to {}.
Here is the toJSON call:
var event =
这篇关于toJSON将格式化日期更改为{}的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!