Date parsing won't work

Feb 3, 2009 at 2:51 PM
When I run SerializeObject a datetime property is parsed to this..


Which then jquery parses to a string "/Date(1231110000000+0100)/" and not a date. Am I doing something wrong here?
Feb 3, 2009 at 5:12 PM
Edited Feb 3, 2009 at 5:13 PM
No this is just how json dates are handled in .NET when serialized. Run the following on your json before your eval it into an object on the client side:

replace(/"\\\/Date\(([0-9]+)[0-9-]+\)\\\/"/gi, 'new Date(parseInt($1,10))')
Feb 4, 2009 at 4:17 AM
Using JavaScriptDateTimeConverter when serializing will write a date in the format 'new Date(123456789)'.
Feb 4, 2009 at 8:20 AM
Edited Feb 4, 2009 at 8:24 AM
Sorry, I read the documentation instead. Thanks for the help.