This commit is contained in:
BoHung Chiu 2022-08-03 19:29:47 +08:00
parent 51eba82b2a
commit 3e08373443
1 changed files with 18 additions and 1 deletions

View File

@ -194,6 +194,15 @@ var Calendar = function(dom,page_id,event_date=''){
var agendaView = new AgendaView(c);
var loadeventsonviewchange = false;
this.success_event = null;
this.eventDataTransform = function(eventData){
if(eventData.allDay && eventData.end){
var tmp = new Date(eventData.end);
tmp.setTime(tmp.getTime() + 86400000); // Add one day for displaying
eventData.end = tmp.toISOString();
//eventData.end = eventData.end;
}
return eventData;
};
this.initialize = function(){
if (event_date != ''){
var event_dates = event_date.split("-");
@ -234,6 +243,7 @@ var Calendar = function(dom,page_id,event_date=''){
}
});
},
eventDataTransform: c.eventDataTransform,
// events: 'https://fullcalendar.io/demo-events.json',
headerToolbar: false,
fixedWeekCount: false,
@ -418,7 +428,14 @@ var EventDialog = function(calendar,event){
if(!_event) throw new UserException("EventStick can't be null!");
_event.allDay = _event.event.allDay;
_event._start = _event.event.start;
_event._end = (_event.event.end ? _event.event.end : _event.event.start);
if(_event.event.end){
_event._end = _event.event.end;
if(_event.allDay){
_event._end.setTime(_event._end.getTime() - 86400000);
}
}else{
_event._end = _event.event.start;
}
// var start_date = getDateString(_event._start,calendar_variable.date_format);
// var end_date = getDateString(_event._end,calendar_variable.date_format);
_event.title = _event.event.title;