| Issue 2145: | All-day event listed one day too soon if the string to the Moment.js object includes a time substring | |
| 1 person starred this issue and may be notified of changes. | Back to list |
Hello
Since I wasn't able to find a CDN version of the v2.0.0-beta2 files I hope you'll be able to work from the example further down.
Turns out that if the string passed to the new moment object contains a time part even through it's marked as an all-day event (something that can happen when used with auto-generated code), the event won't be listed on the day you want, but the one before.
In the following example, the event for 2014-12-25 will show up on 2014-12-24 and the same offset occurs with the event after it.
Stripping the time part from the string will fix this offset, but it seems like this could become a common problem for people new to the plugin.
Thanks in advance for taking a look at it.
<div id="dashboard-event-calendar"></div>
<script type="text/javascript" src="calendarproject/assets/js/moment.min.js"></script>
<script type="text/javascript" src="calendarproject/assets/js/fullcalendar/fullcalendar.min.js"></script>
<script type="text/javascript" src="calendarproject/assets/js/fullcalendar/lang/de.js"></script>
<script>
$('#dashboard-event-calendar').fullCalendar({
header: {
left: 'prev,today,next',
center: 'title',
right: ''
},
weekNumbers: true,
editable: false,
height: 400,
defaultDate: $.fullCalendar.moment("2014-12-23"),
events: [
{
title: '1.\x20Weihnachtstag'
,start: $.fullCalendar.moment("2014-12-25T00:00:00")
,allDay: true
,color: '\x23F16D5F'
},
{
title: '2.\x20Weihnachtstag'
,start: $.fullCalendar.moment("2014-12-26T00:00:00")
,allDay: true
,color: '\x23F16D5F'
}
],
eventRender: function(event, element) {
element.prop('title', (event.tooltip || event.title) );
}
});
</script>
May 25, 2014
(No comment was entered for this change.)
Labels:
milestone-date
May 25, 2014
your calls to $.fullCalendar.moment guarantee that the moment will be in *local* time, which will might make the event appear the day before because of the timezone offset. Either use $.fullCalendar.moment.parseZone with the same argument, which will cause the event to be in an ambiguous timezone, OR simple don't just include the literal string, with no moment call whatsoever: title: '1.\x20Weihnachtstag' ,start: "2014-12-25T00:00:00" ,allDay: true ,color: '\x23F16D5F'
May 25, 2014
(No comment was entered for this change.)
Status:
Done
May 26, 2014
Thanks. I'm just worried that this could turn into a common problem for plenty of other people down the road.
May 29, 2014
i will change the docs to make this more clear. thanks.
Status:
Accepted
Labels: Type-Docs
May 29, 2014
added some clarity to the following docs: http://arshaw.com/fullcalendar/docs2/utilities/Moment/ http://arshaw.com/fullcalendar/docs2/event_data/Event_Object/ thanks!
Status:
Done
|
|
| ► Sign in to add a comment |
Status: Reproducing