0

What's a reason that fullcalendar end day of event shows wrong. For example I have date

8-Dec

but in console.log it

Thu Dec 9 2016 01:00:00 GMT+0100 (CET)

How can I fix it?

Pawel Novikov
  • 465
  • 1
  • 11
  • 26

2 Answers2

0

I had the same problem with applying fullcalendar in Salesforce. The data model contains Date fields, but whenever I tryied to insert date, it had +1 day because of my local timezone GMT+3.

Please try to convert to GMT time in javascript with substructing timezone offset, like I did below, if it works for you:

const prepareEvent = function(templateId, startTime, endTime, Id){
    ............
    calendarEvent.Active_From__c = new Date(startTime).getTime() - new Date(startTime).getTimezoneOffset() * 60000;
    calendarEvent.Active_To__c = new Date(endTime).getTime() - new Date(endTime).getTimezoneOffset() * 60000;
    ............
}
-1

I would suggest you to convert timezone of end date.

Dayachand Patel
  • 469
  • 4
  • 12