kendoui scheduler timezone problem - hours shifted when sent to server

61 Views Asked by At

even if i setted the timezone both on the scheduler and the related datasource to "Europe/Rome", when the scheduler sends the data to the server the date is shifted two hours back (in the post payload) so consequentlythe server infer the date 2 hours back regardless of itc culture

enter image description here

1

There are 1 best solutions below

0
Derek On

This was an issue in 2019.3.1023, and I don't know if it was fixed.

https://github.com/telerik/kendo-ui-core/issues/4567

Setting the timezone in kendoScheduler.timezone or dataSource.schema.timezone seems to be ignored when posting.

Edit: wanted to add, using parameterMap you can alter options.model before it is sent. We are using moment.utc() to adjust for timezone issue.

parameterMap: function(options, operation) {
    if (operation !== "read" && options.models) {
        switch(operation) {
            case 'create':
            case 'update':
                options.models.forEach((v, k) => {
                    options.models[k].start = moment.utc(kendo.stringify(options.models[k].start),"YYYY-MM-DDTHH:mm:ss.SSSZ").format("YYYY-MM-DD HH:mm:ss");
                }
                break;
        }
    }
}