I am using Servicestack and Ormlite for my project and testing with postman.
The C# type I am using for my timestamps is DateTime and it processes the info correctly to and from the MySql database. When I return the value in my response the value looks correct but when the response is inspected in either Postman or just browsing to the the request url the value I see is
[
{
"id": 1,
"accountType": 1,
"name": "Mr J Smith",
"memberSince": "/Date(1539189581000-0000)/",
"phone": "8138138138",
"email": "jjj@jjj.com",
"emailVerified": false
}
]
The value I send out is
MemberSince = {10/10/2018 12:39:41 PM}
Why the discrepancy? Is it a different format? How do I globally convert it?
UPDATE
I add this to my initialization routine and it works. Is this the best way to do this?
JsConfig<DateTime>.SerializeFn = time => new DateTime(time.Ticks, DateTimeKind.Utc).ToString("o");
JsConfig<DateTime?>.SerializeFn = time => time != null ? new DateTime(time.Value.Ticks, DateTimeKind.Utc).ToString("o") : null;
JsConfig.DateHandler = DateHandler.ISO8601;