FullCalendar v2: Selecting day in month returns incorrect start or end date

In version 1.x of FullCalendar, when Tue , Sept. 30th in the Month view was selected, the startDateTime would be something like " Tue Sep 30 2014 00:00:00 GMT-0400 (EDT)" and the endDateTime would be " Tue Sep 30 2014 00:00:00 GMT-0400 (EDT)". This is good, it tells me that Tuesday September 30th 2014 was clicked and no time was specified by the user because they just clicked a day.

Now in version 2.1.1, when Tue , Sept. 30th in the Month view is selected, the start date is " Mon Sep 29 2014 20:00:00 GMT-0400 (EDT)" and the end date is " Tue Sep 30 2014 20:00:00 GMT-0400 (EDT)".

The start date is incorrect because Tuesday was clicked, not Monday . As the day goes on, eventually the start date will be Tuesday and the end date will be Wednesday.

Is there an option (or workaround) I'm missing so that I can just get the date that was clicked in the month view and not this arbitrary span of time?


As of FullCalendar 2.*, MomentJS is used to treat the dates.

Given this, start and end are momentjs objects. If you only want the date of the clicked day you can use:

console.log(start.format('YYYY-MM-DD'))

Here's the updated JsFiddle

链接地址: http://www.djcxy.com/p/81240.html

上一篇: 在FullCalendar中重复发生隔夜事件

下一篇: FullCalendar v2:在月份中选择日期会返回不正确的开始日期或结束日期