Our pure JavaScript Scheduler component


Post by dennisli »

Hi,

I'm a little stuck here and confused on how to proceed.

1. The sync updated startDate that I see in the scheduler UI doesn't match the message body that's sent to the server. I'm based in PTC, so it should be UTC-8
Screen Shot 2020-03-28 at 12.44.40 AM.png
Screen Shot 2020-03-28 at 12.44.40 AM.png (21 KiB) Viewed 2202 times
As you can see, the startDate for this is for 3/3 11pm

But when I inspect the request body, I get this:
{"type":"sync","requestId":15853814670831,"events":{"updated":[{"demandId":"iteration-0-242","freeze":false,"resourceId":"Calciner MCC4A1","eventColor":"#c587c2","startDate":"2020-03-04T08:00:00.000Z","endDate":"2020-03-04T13:14:20.000Z","duration":0.21828703703703703,"durationUnit":"d","cls":"","name":"Order 242: 2016 of 50430241","id":"iteration-0-242[2]"}]}}
Namely, the startDate is 2020-03-04T08:00:00.000Z ie March 4 midnight instead of March 3 11pm. What's going on??

2. I just noticed that the header for view presets defaults to DD/MM, but problematically, I am based in the states where we prefer MM/DD :)

I know I can create custom viewPresets to override the default header format, but I don't know how I would do that for every zoom level. Is there an easy way to change the locale at all levels?

Best,
Dennis
Attachments
Screen Shot 2020-03-28 at 12.44.40 AM.png
Screen Shot 2020-03-28 at 12.44.40 AM.png (21 KiB) Viewed 2203 times

Post by sergey.maltsev »

Hi!

UI should not reflect API date formats used by crudManager they both could be configured separately.

You could check info here how to customize date format for client/sever protocol.
viewtopic.php?f=44&t=13303&p=69246#p69246

If you still have questions please attach simple sample application here so we could check it to give you some advice.

Post by dennisli »

I'm not sure I fully understand that they should be configured separately. In this particular case, my server is sending dates that are timezone agnostic, and I want to send back dates on sync that are also timezone agnostic. My concern is that it seems like bryntum is assuming timezone information when it parses the date, and thus also sending back a different date to my server on sync.

Post by sergey.maltsev »

Hi!

Scheduler doesn't have built-in support for setting custom timezone for protocol yet.
It uses client's timezone to encode date.

You could either use your own way to encode date (see my link above) or add extra timezone flag which will refer to the clients timezone to be sent to server as an extra HTTP request parameter (see https://www.bryntum.com/docs/scheduler/#Scheduler/data/CrudManager).

We're also available for Professional Services: https://www.bryntum.com/services.

Post by dennisli »

I just tried the above solution, but I'm not quite sure I understand. Here's an example of what i'm trying to solve. It looks like a bug on bryntum's part....

My server sends an event with the following information:
startDate: "2020-02-29T13:41:20.938806",
endDate: "2020-02-29T22:58:09.084404"
the native Date class in javascript has no difficulty parsing this:
x = new Date('2020-02-29T13:41:20.938806')
Sat Feb 29 2020 13:41:20 GMT-0800 (Pacific Standard Time)
But when I use bryntum, the UI shows that the event is at 12:41PM rather than 13:41PM.
Screen Shot 2020-03-30 at 5.21.25 AM.png
Screen Shot 2020-03-30 at 5.21.25 AM.png (25.28 KiB) Viewed 2190 times

Post by sergey.maltsev »

Hi, dennisli!

Please attach full test app we can check here. May be this is related to Daylight Saving Time currently applied in some countries.
I can't say for sure until we could have some code with your data to test.
Please update any of our demos with your data and attach here so we could run and see the problem

Post by dennisli »

Sergey,

I understand you want a demo app but this is internal code that i cannot share, part of a larger app. This is a fairly minimal setup though wherein the crudmanager gets back data like that which I described above. I have not modified the start/endDate parsing or formats. I have just tried testing and I know daylight savings started on March 8, 2020.

So if I try a date after march 8... e.g.
// startDate: "2020-03-08T20:38:56.122814"
// endDate: "2020-03-08T22:58:11.371710"

It appears that the UI renders as expected.

Given that, how do I disable daylight savings? My backend already handles it.
Screen Shot 2020-03-30 at 6.43.56 AM.png
Screen Shot 2020-03-30 at 6.43.56 AM.png (15.46 KiB) Viewed 2186 times

Post by sergey.maltsev »

Hi!

While scheduler doesn't support time zone setting it may use another timezone then your server does.
Could you confirm that server and client app have the same time zone?

Post by dennisli »

They are not in the same timezone, but the data itself is timezone agnostic. ie it does not worry about timezones, or at least not, daylight savings. You'll notice in the example above there is no 'Z' because it is not operating in UTC time - it is just a generic agnostic time.

Can the scheduler simply assume date it receives are in local time without adding or subtracting an hour for timezones? ie i want a "dumb" date parser that does not attempt to handle regional differences. I want something that behaves like the native javascript Date parser.

Post by sergey.maltsev »

Hi, dennisli!

I've made few tests and the bug is confirmed.
This is issue to fix it
https://github.com/bryntum/support/issues/501


Could you try to use time format sent from server without milliseconds?
startDate: "2020-02-29T13:41:20",
endDate: "2020-02-29T22:58:09"

Post Reply