Commit ac838f46 authored by Jim Driessen's avatar Jim Driessen
Browse files

Fix invalid dates when there was no upcoming activity.

parent bfcfe345
......@@ -53,7 +53,11 @@
// History idea and code parts from
// https://github.com/fullcalendar/fullcalendar/issues/659#issuecomment-132535804
// and https://github.com/fullcalendar/fullcalendar/issues/659#issuecomment-245544401
var startDate = new Date('{{ upcoming_activity.start|date:'Y-m-d' }}');
{% if upcoming_activity %}
var startDate = new Date('{{ upcoming_activity.start|date:'Y-m-d' }}');
{% else %}
var startDate = new Date();
{% endif %}
var tmpYear = startDate.getFullYear();
var tmpMonth = startDate.getMonth();
var tmpDay = startDate.getDate();
......@@ -125,14 +129,13 @@
},
viewRender: function(view) {
var moment = calendarDiv.fullCalendar('getDate');
if (moment) {
if (moment && moment.isValid()) {
window.location.hash = 'year=' + moment.format('YYYY') + '&month=' + (moment.format('M')) + '&day=' + moment.format('DD') + '&view=' + view.name;
}
}
});
var date = new Date(tmpYear, tmpMonth, tmpDay, 0, 0, 0);
var d = calendarDiv.fullCalendar('getDate');
var moment = calendarDiv.fullCalendar('getDate');
var view = calendarDiv.fullCalendar('getView');
if (date.getFullYear() != moment.format('YYYY') ||
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment