LitJSON / litjson

JSON library for the .Net framework
https://litjson.net/
Other
1.36k stars 403 forks source link

Fix DateTimeOffset support. #108

Closed kenykhung closed 4 years ago

kenykhung commented 4 years ago

Add missing exporter for DateTimeOffset and add related test case. Sample:

class Test
{
    public DateTimeOffset TestDateTimeOffset { get; set; }
}
static void Main(string[] args)
{
    var c = new Test
    {
        TestDateTimeOffset = DateTimeOffset.Now,
    };
    var result = LitJson.JsonMapper.ToJson(c); // This will raise exception
    Console.WriteLine(result);
    Console.ReadKey();
}