How to work with timezones and full_day scheduler


#1

We’ve set full_day to true on our scheduler. But when we create a new event, it looks like the start/end times are midnight UTC but are then converted to local TZ (so they appear 7pm - 7pm).

What’s the right way to deal with this? I realize we could clear the hours/minutes before the lightbox is displayed.

I also see that server_utc defaults to false. I tried setting that but didn’t help

Or should we just force everything to UTC somehow?


#2

Hi,

Please update the code in the snippet tool http://snippet.dhtmlx.com/094c9c7bf
share with me the updated link and specify steps how to reproduce the issue.


#3

Thanks that helped, I think I found the issue with our code, it was some issue with the year_view, but I was having difficulty reproducing the entire issue with the smaller code sample.

But I was able to demonstrate at least part of the issue here: http://snippet.dhtmlx.com/3cdc8145f

Create a new event from the month view and the all day is checked, do it from the year view and it is not.


#4

Add the code below to the onBeforeLightbox handler to solve the issue.

scheduler.attachEvent("onBeforeLightbox", function (id){
	var mode = scheduler.getState().mode;
    if(mode == "year" && scheduler.getState().new_event){
      var ev = scheduler.getEvent(id);
      ev.start_date.setHours(0);
      ev.end_date.setHours(0);
    }
    
    return true;
});

Demo http://snippet.dhtmlx.com/dff25605b


#5

Yea, I can always force it (which is what I was doing). Just unclear why I needed to do that (wasn’t clear how the TZ translation (which is what it looked like was going on) was being done).