Date format is not working in nested level


#1

When we try to save the below JSON into CBLite database, it is not working as it throws an exception saying DateTime is not a valid type

     {
            "id": "3243717",
            "createdate":"2018-06-14T06:02:59.483Z",
            "nestedObject":{
            	"nestedDate": "2018-06-14T06:02:59.483Z"
            }
        } 

This happens only for the nestedDate date property. If we remove T from date string, then it would work fine. Whereas we don’t need to remove T from createdate property
Can someone please explain why this happens?


#2

You need to use DateTimeOffset, not DateTime.


#3

Thanks Jim. May I know the reason why the same date string is working at root level. I mean, createdate is working whereas nestedDate not


#4

I’m not sure about that, but the intended behavior is to only allow DateTimeOffset since DateTime is too ambiguous.