asp.net mvc - Prevent JsonResult from auto-formatting Dates -


i'm writing cloud based program utilizes utc date saving server, , convert on round trip. problem is, instance in cloud autoconverting jsonresult datetime values according localization settings on browser obtaining result.

i have gone through tons of steps make sure server side code on both levels returning proper data, , on instances, , no javascript code on page making change either (even removed javascript date formatting in case), have traced out firebug determine exact point changes, when page receives json result jsonresult method. said, have debugged values before being sent page, , proper, , on response, modified based upon browser location....

has had similar problem?

value returned:date(1341792000000) 07/08/2012 17:00

should be: date(1341817200000) (07/09/2012 12:00am)

thanks

i ended getting proper results, many modifications application. did lot of stuff make happen... first, implemented timezone.js listing of timezones used within application, , used jstz current timezone of browser loading page. next, have make (for mvc) file method accesses timezones load timezonejs.

next, on save of timezone, specified pst type, , convert utc on roundtrip update interface.

on formatting of json date, run timezonejs method , timezone name jstz, , set new date value such:

var timezone = jstz.determine(); timezonejs.timezone.zonefilebasepath = '/item/gettz'; // file method var dt = new timezonejs.date(parseint(jsondate.substr(6), timezone.name())); // strips out date json date dt.settimezone('america/los_angeles'); 

this allows on cloud projects ran on server, , displayed in browser regardless of timezone, , allow user view , configure timezone sensitive data natively, , allow users see start/end date of configurable database values.


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -