This is a migrated thread and some comments may be shown as answers.

Scheduler forces Pacific(my local) on an update everytime

2 Answers 25 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
danparker276
Top achievements
Rank 2
danparker276 asked on 01 Aug 2014, 03:30 AM
            $("#scheduler").kendoScheduler({
                timezone: "Etc/UTC", //still it gives pacific?
                date: selectedDate,
....

why? 

I have the 
src="/Scripts/kendo.all.min-2.js"

in it too.

This is on an update and save,  does my datasource need to change:

                dataSource: {
                    batch: true,
                    transport: {
                        read: {
                            url: baseURL + "?mode=read",
                            dataType: "json",
                            type: "POST",
                            contentType: "application/json; charset=utf-8"
                        },
                        update: {
                            url: baseURL + "?mode=update",
                            dataType: "json",
                            type: "POST",
                            contentType: "application/x-www-form-urlencoded; charset=UTF-8",
                            complete: function (e) {
                                //need to reload because of the timezone problems
                                $("#scheduler").data("kendoScheduler").dataSource.read();
                            }
                        },
                        create: {
                            url: baseURL + "?mode=create",
                            dataType: "json",
                            type: "POST",
                            contentType: "application/x-www-form-urlencoded; charset=UTF-8",
                            complete: function (e) {
                                $("#scheduler").data("kendoScheduler").dataSource.read();
                            }
                        },
                        destroy: {
                            url: baseURL + "?mode=destroy",
                            dataType: "json",
                            type: "POST",
                            contentType: "application/x-www-form-urlencoded; charset=UTF-8",
                            complete: function (e) {
                                $("#scheduler").data("kendoScheduler").dataSource.read();
                            }
                        },
                        parameterMap: function (options, operation) {
                            if (operation !== "read" && options.models) {
                                return { models: options.models };
                            }
                        }
                    },
                    options: {
                        model: {
                            id: "taskId",
                            fields: {
                                taskId: { from: "TaskID", type: "number" },
                                title: { from: "Title", defaultValue: "No title", validation: { required: true} },
                                start: { type: "date", from: "Start" },
                                end: { type: "date", from: "End" },
                                ownerId: { from: "OwnerID", defaultValue: 1 }
                            }
                        }
                    },
                    schema: {
                        model: {
                            id: "taskId",
                            fields: {
                                taskId: { from: "TaskID", type: "number" },
                                title: { from: "Title", defaultValue: "No title", validation: { required: true} },
                                start: { type: "date", from: "Start" },
                                end: { type: "date", from: "End" },
                                ownerId: { from: "OwnerID", defaultValue: 1 }
                            }
                        }
                    }
                },

2 Answers, 1 is accepted

Sort by
0
danparker276
Top achievements
Rank 2
answered on 01 Aug 2014, 10:08 PM
Sorry, I think that has to do with json serialization that's happening and adding pacific time zone
0
Vladimir Iliev
Telerik team
answered on 05 Aug 2014, 06:25 AM
Hi Dan,

From the provided information it's seems that the "Start" and "End" dates are not correctly stringified - could you please try to update the "parameterMap" function as follows:

parameterMap: function(options, operation) {
    if (operation !== "read" && options.models) {
 
        //stringify dates correctly
        options.models[0].Start = kendo.stringify(options.models[0].Start);
        options.models[0].End = kendo.stringify(options.models[0].End);
 
        return {
            models: options.models
        };
    }
}

Also I notice that there is "option" option added to the dataSource which contains the same configuration as the "dataSource.schema" - please note that there is no such option and it should be removed:

e.g.:
dataSource: {
    batch: true,
    transport: {
        read: {
            url: baseURL + "?mode=read",
            dataType: "json",
            type: "POST",
            contentType: "application/json; charset=utf-8"
        },
        update: {
            url: baseURL + "?mode=update",
            dataType: "json",
            type: "POST",
            contentType: "application/x-www-form-urlencoded; charset=UTF-8",
            complete: function(e) {
                //need to reload because of the timezone problems
                $("#scheduler").data("kendoScheduler").dataSource.read();
            }
        },
        create: {
            url: baseURL + "?mode=create",
            dataType: "json",
            type: "POST",
            contentType: "application/x-www-form-urlencoded; charset=UTF-8",
            complete: function(e) {
                $("#scheduler").data("kendoScheduler").dataSource.read();
            }
        },
        destroy: {
            url: baseURL + "?mode=destroy",
            dataType: "json",
            type: "POST",
            contentType: "application/x-www-form-urlencoded; charset=UTF-8",
            complete: function(e) {
                $("#scheduler").data("kendoScheduler").dataSource.read();
            }
        },
        parameterMap: function(options, operation) {
            if (operation !== "read" && options.models) {
                return {
                    models: options.models
                };
            }
        }
    },
    schema: {
        model: {
            id: "taskId",
            fields: {
                taskId: {
                    from: "TaskID",
                    type: "number"
                },
                title: {
                    from: "Title",
                    defaultValue: "No title",
                    validation: {
                        required: true
                    }
                },
                start: {
                    type: "date",
                    from: "Start"
                },
                end: {
                    type: "date",
                    from: "End"
                },
                ownerId: {
                    from: "OwnerID",
                    defaultValue: 1
                }
            }
        }
    }
},

Regards,
Vladimir Iliev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Scheduler
Asked by
danparker276
Top achievements
Rank 2
Answers by
danparker276
Top achievements
Rank 2
Vladimir Iliev
Telerik team
Share this question
or