Skip to content

Commit

Permalink
Add 1 day to end date in calandar to display it correct #26
Browse files Browse the repository at this point in the history
  • Loading branch information
geofranzi committed Jan 10, 2020
1 parent e263d25 commit 752a3e1
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions Views/Calendar/Calendar.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -104,17 +104,23 @@
var events = [];
$.each(doc, function (key, value) {
var val = $.parseJSON(value[0]);
// the end date is exclusive in fullcalendar. To display the duration correct 1 days needs to be added
var new_end_date = new Date(val['end']);
new_end_date.setDate(new_end_date.getDate() + 1);
events.push({
allDay: true,
title: val['title'],
start: val['start'],
end: val['end'],
end: new_end_date,
color: val['color'],
eventId: val['eventId']
});
});
callback(events);
console.log(events);
}
});
}
Expand All @@ -131,11 +137,16 @@
var events = [];
$.each(doc, function (key, value) {
var val = $.parseJSON(value[0]);
// the end date is exclusive in fullcalendar. To display the duration correct 1 days needs to be added
var new_end_date = new Date(val['end']);
new_end_date.setDate(new_end_date.getDate() + 1);
events.push({
allDay: true,
title: val['title'],
start: val['start'],
end: val['end'],
end: new_end_date,
color: val['color'],
eventId: val['eventId']
});
Expand All @@ -159,11 +170,16 @@
var events = [];
$.each(doc, function (key, value) {
var val = $.parseJSON(value[0]);
// the end date is exclusive in fullcalendar. To display the duration correct 1 days needs to be added
var new_end_date = new Date(val['end']);
new_end_date.setDate(new_end_date.getDate() + 1);
events.push({
allDay: true,
title: val['title'],
start: val['start'],
end: val['end'],
end: new_end_date,
color: val['color'],
eventId: val['eventId']
});
Expand All @@ -186,10 +202,15 @@
var events = [];
$.each(doc, function (key, value) {
var val = $.parseJSON(value[0]);
// the end date is exclusive in fullcalendar. To display the duration correct 1 days needs to be added
var new_end_date = new Date(val['end']);
new_end_date.setDate(new_end_date.getDate() + 1);
events.push({
title: val['title'],
start: val['start'],
end: val['end'],
end: new_end_date,
color: val['color'],
eventId: val['eventId'],
allDay: val['allDay']
Expand Down Expand Up @@ -255,6 +276,7 @@
window.location.href = '../Schedule/Show/' + id;
})
},
});
Expand Down

0 comments on commit 752a3e1

Please sign in to comment.