Richard
Richard

Reputation: 948

Disable UTC for allDay events' start and end moment in FullCalendar

I was wondering if there is a way to have the start and end moments in the select (callback) method be initialised and displayed as the machine's local timezone instead of UTC.

I understand that FullCalendar wants all-day events to be displayed as 12:00am to 12:00am regardless of the timezone (hence why it is always UTC by default, display and when its called back), but since I'm using the calendar to schedule time sensitive events, I would like it to use the local timezone.

Upvotes: 0

Views: 1017

Answers (1)

Richard
Richard

Reputation: 948

So I figured out a workaround to how full calendar handles all day events by using a nuance of momentjs.

If a string is given to moment(string) without specifying a timezone, it automatically creates a date in local time.

All I had to do was:

start = moment(start.format());
end = moment(end.format());

Upvotes: 3

Related Questions