c# - Date converted from JSON incorrectly -
i sending 2 date ranges represent start , end of current week. conversion of dates not i'm expecting on server side. start date fine, end date day out don't quite understand why?
console.log output
date {mon may 13 2013 00:00:00 gmt+0100 (gmt daylight time)}  date {sun may 19 2013 23:59:59 gmt+0100 (gmt daylight time)}   the js creates above output
var startofweek = moment().day(1).hour(0).minute(0).second(0).todate() var endofweek = moment().day(7).hour(23).minute(59).second(59).todate() console.log(startofweek, endofweek)   json
{"start":"2013-05-12t23:00:00.000z","end":"2013-05-18t23:00:00.000z"}   c#
start: {13/05/2013 00:00:00} end: {18/05/2013 23:59:59}   controller
public httpresponsemessage getallcampaignsbydate(daterange _daterange) { }   model
public class daterange {     private datetime m_start;     private datetime m_end;      public datetime start     {         get{ return m_start; }         set { m_start = value.tolocaltime(); }     }      public datetime end     {         { return m_end; }         set { m_end = value.tolocaltime().addseconds(-1); }     } }      
it may have moment.js using iso8601 (the z on end of string indicates utc) , going through tolocaltime().
Comments
Post a Comment