Scheduler forces Pacific(my local) on an update everytime

3 posts, 0 answers
  1. danparker276
    danparker276 avatar
    389 posts
    Member since:
    Aug 2010

    Posted 31 Jul 2014 Link to this post

                $("#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. danparker276
    danparker276 avatar
    389 posts
    Member since:
    Aug 2010

    Posted 01 Aug 2014 in reply to danparker276 Link to this post

    Sorry, I think that has to do with json serialization that's happening and adding pacific time zone
  3. Kendo UI is VS 2017 Ready
  4. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2172 posts

    Posted 05 Aug 2014 Link to this post

    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!
     
Back to Top