fullcalendar/fullcalendar-angular

Double Localization of Range Start (event._instance.range)

ISievah opened this issue · 1 comments

Recreation

Source Data

sourceData = {
    source: 'My Source',
    events: [
      {
        title: 'RE01',
        start: '2021-10-14T18:42:00+00:00',
        end: '2021-10-14T19:42:00+00:00',
        rrule: {
          dtstart: '2021-10-14T18:42:00+00:00',
          freq: 'weekly',
          interval: 2
        }
      }
    ],
    color: 'blue',
  };

Calendar Options

this.calendarOptions = {
      headerToolbar: {
        left: 'prev,next today',
        center: 'title',
        right: 'dayGridMonth,listMonth',
      },
      footerToolbar: {
        left: 'addEventButton',
      },
      eventTimeFormat: {
        hour12: false,
        hour: '2-digit',
        minute: '2-digit'
      },
      initialView: 'dayGridMonth',
      eventClick: this.handleDateClick.bind(this),
      eventSources: [this.sourceData]
    };
  }

Handle Date Click

handleDateClick(clickInfo: EventClickArg) {
    console.log('*** clickInfo.event.start ***');
    console.log(clickInfo.event.start);
    console.log('*** clickInfo.event.end ***');
    console.log(clickInfo.event.end);
    console.log('*** clickInfo.event._instance.range.start ***');
    console.log(clickInfo.event._instance.range.start);
    console.log('*** clickInfo.event._instance.range.end ***');
    console.log(clickInfo.event._instance.range.end);
}

Bug?

My locality is GMT -04:00 and I need the start and end of the particular event I've clicked. I thought I could use clickInfo.event._instance.range for that purpose, but the time is 4 hours off. Notice the difference between clickInfo.event.start (which is correct) and clickInfo.event._instance.range.start (which is GMT -08:00, although it purports to be GMT -04:00). Is it being localized twice? Or am I doing something wrong? I would have used clickInfo.event.start, but clickInfo.event.end is null.

Console Output

*** clickInfo.event.start ***
Thu Oct 14 2021 14:42:00 GMT-0400 (Eastern Daylight Time)

*** clickInfo.event.end ***
null

*** clickInfo.event._instance.range.start ***
Thu Oct 14 2021 10:42:00 GMT-0400 (Eastern Daylight Time)

*** clickInfo.event._instance.range.end ***
Thu Oct 14 2021 11:42:00 GMT-0400 (Eastern Daylight Time)

Please refer to the support page and use Stack Overflow for help. If this is a bug, please supply a runnable, stripped-down demonstration.