Display different timezones

Hi,

How do I display different timezones? I know the scheduler assumes the dates are in UTC format and automatically converts to the local timezone. How do I disable that and display the dates as is?

Hello,

I know the scheduler assumes the dates are in UTC format and automatically converts to the local timezone.
Actually, no. By default it treats it as a local date.
The option you are looking for is

scheduler.config.server_utc = false;

Best regards,
Ilya

Thanks, I did that already. But I still see the times in the UTC format while saving an event. I put a simple alert to print out the values being saved when adding an event. And I see the times in the UTC format.

scheduler.attachEvent("onEventAdded", function(event_id,event_object){
var str = JSON.stringify(event_object);
alert(str);

Ok, take a step back and check the same on our samples which use database. Create new event, modify existing one and check what dates are actually stored in DB.

Best regards,
Ilya

Ok, let me get back to you after trying that out.

But fyi, even if the db stores proper values, in my case, it will be a problem.
I am using Spring mvc and need to perform some logic before storing the information in the db. So that code will be working on the values returned from the js.

What I wanted to show that dates are saved and used correctly.

Simply replace your JSON.stringify to alert or console.log - you will see correct dates.

Best regards,
Ilya

Thanks Ilya. I tried the scheduler.getEventStartDate(event_id) and it worked fine.
So looks like it the value is correct but the “stringify” parses it differently.

In this case, how do I generate data in JSON format from a scheduler event correctly? OR do I have to manually use the API to get each field’s value?

Hello,

Be sure to check following sample:
scheduler\samples\04_export\02_serialize_json.html

Best regards,
Ilya

Checked it out. Will that work in terms of getting what event the user added? Seems like it converts existing data to JSON. I am trying to capture data for an event that the user is trying to add.

Hello,

Indeed, it converts all events.

In your case the best options would be:

  1. Write your own function to convert to JSON
  2. Edit existing one (check sources/ext/serialize.js). It’s rather small and would be easy to add support to convert single event.

Best regards,
Ilya