Event : 产品预订定于3月9日开始,11日结束,但日历显示为提前一天结束日视图网格。但是用周网格视图显示全天没有问题。我附上了屏幕截图以供参考。你能帮忙吗?
代码:
eventDataTransform: function (eventData) {
console.log('EventDataStart-->'+eventData.start);
console.log('EventDataEnd-->'+eventData.end);
/*var m = moment(eventData.end);
var roundDown = m.startOf('day');
var day2 = moment(roundDown).add(1, 'days')
eventData.end = day2.toString();
console.log('EventDataEndAfter-->'+eventData.end);*/
var dur = eventData.end - eventData.start; //total event duration
if(dur >= 18000000 || eventData.end == null){ // 5 hours
eventData.allDay = true;
eventData.allDaySlot = true;
console.log('dur-->'+dur);
//eventData.end needs ammending to 00:00:00 of the next morning
if (dur > 86400000) {
var m = moment(eventData.end);
var roundDown = m.startOf('day');
var day2 = moment(roundDown).add(1, 'days')
eventData.end = day2.toString();
console.log('EventDataEndIf1-->'+eventData.end);
}
}
console.log('eventData-->'+JSON.stringify(eventData));
return(eventData);
}
控制台日志输出: eventData-->{"color":"#FF9800","title":"Cooler | 测试记录 | 时间:09:00 AM - 06:00 PM","start":"2023-03-09T03:30: 00.000Z","end":"Sun Mar 12 2023 00:00:00 GMT+0530","scheduleid":"a0z8F000000ElipQAC","userid":"0058F000000tDxiQAE","description":"时间:09:00 AM - 06:00 PM","popupTitle":"测试记录 -","CAP_Reservations__c":{"type":"CAP_Reservations__c","Id":"a0z8F000000ElipQAC","Name":"CAP-00607","Color__c ":"#FF9800","Number_of_Chafing_Dishes__c":null,"Number_of_Chairs__c":null,"Number_of_Air_Movers__c":null,"Number_of_Tables__c":null,"Number_Of_Six_Tables__c":null,"Agent__c":"0058F000000tDxiQAE","Agent__r":{ "type":"User","Id":null,"Name":"Rohan Kabra"},"CAP_Items__c":"Cooler","Client__c":"0038F00000IssiVQAR","Client__r":{"type":" Contact","Id":null,"Name":"测试记录"},"Drop_Off_Date__c":"2023-03-12T00:00:00.000Z","Pick_Up_Date__c":"2023-03-09T15:00:00.000 Z","Wait_List_Position__c":null,"Number_of_Tents__c":null},"allDay":true,"allDaySlot":true}
以前在添加一天之前(参考代码)它用于显示周网格和天网格的一天。将一天添加到结束日期后,它在周网格上正确显示,但在天网格上不正确。 预期结果:订单应在日网格日历视图中正确显示并具有正确的结束日期。