Our pure JavaScript Scheduler component


Post by kernel »

Hi,
all events in scheduler are placed 2 hours after they should.
Example 1: If I manually move an event to h14:00, I receive this JSON
{"type":"sync","requestId":"15555023537953","events":{"updated":[{"startDate":"2019-04-18T12:00:00.000Z","endDate":"2019-04-18T16:00:00.000Z","id":12}]}}
with "startDate":"2019-04-18T12:00:00.000Z".

Example 2: if I create an event and send it by JSON to scheduler I find it 2 hours later.

How can I fix it? :?
Thanx

Post by mats »

You're specifying date in UTC so assuming you're in European summer time it's correct.

This is 12:00 in Greenwich Mean Time
2019-04-18T12:00:00.000Z
Either specify the date format in your correct timezone, or omit the timezone info completely.

Post by kernel »

Hi mats, thanks. I read that Scheduler uses momentjs and i found how the set correct timezone but.. where in Scheduler? No problem for me to omit completely (I don't need it) timezone info but same question: where?
Thank you!

Post by pmiklashevich »

MomentJS is not used anymore. What version of Bryntum sources do you use? I would recommend you to try to keep them up to date always.

Pavlo Miklashevych
Sr. Frontend Developer


Post by kernel »

Hi, I updated the Scheduler.
If i set StartDate to 2019-07-15 and then I move event to 2019-17-16 h:00:00, the JSON response of startDate is 2019-07-15T22:00:00.002Z

I am in GMT+2 but, how can i change scheduler TimeZone to set in GMT+2 by default?
Thanks

Post by pmiklashevich »

That is how Javascript works.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toJSON
foo = { start : new Date() }
// {start: Wed Jul 17 2019 15:36:19 GMT+0300 }
str = JSON.stringify(foo)
// "{"start":"2019-07-17T12:36:19.031Z"}"\
bar = JSON.parse(str)
// {start: "2019-07-17T12:36:19.031Z"}
new Date(bar.start)
// Wed Jul 17 2019 15:36:19 GMT+0300
And that is preferable behaviour, since when you transfer/save data in UTC you can anytime convert it into a local time.

Pavlo Miklashevych
Sr. Frontend Developer


Post Reply