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

KendoDatePicker : JSON.stringify function for kendoDatePicker value is giving wrong date

1 Answer 1032 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
Ambica
Top achievements
Rank 1
Ambica asked on 08 Mar 2013, 10:56 AM
Hi ,
In my scenario, have to call web service with StartDate of string type  (POST operation), 
am using JSON. Stringify method to convert data into json format .

My problem is while stringifying my data , date is going back by one day.

code:
    var tStartDate = $("[Name=StartDate]").data("kendoDatePicker").value()
            value is : Mon Mar 04 2013 00:00:00 GMT+0530 (India Standard Time) (here time 00:00:00)

    JSON.stringify(tStartDate)
                     This giving :  2013-03-03T18:30:00.000Z instead of 2013-03-04T18:30:00.000Z
So how can I get correct Date here ? in our DB using DateTimeOffset type for storing this date value 

Please help me out .



1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 12 Mar 2013, 09:32 AM
Hello Ambica,

The described behavior is actually expected. The kendo.stringify, like the native JSON.stringify serializes dates using UTC time. Hence the shown date without five and a half hours is previous day. Check this jsBin demo for more information. If you want to change this behavior you will need to specify a parameterMap function and serialize Date objects manually.

Regards,
Georgi Krustev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Date/Time Pickers
Asked by
Ambica
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or