Hello,
I think there is some bug in the .NET Couchbase.Lite library when parsing dates.
To reproduce this, synchronize a CBL-Database with a full Couchbase server and create the same objects on both endpoints (CBL+CBS).
If you create a date in the CBL-DB with the MutableDocument.SetDate - method, after synchronizing, the date is stored in the following format:
"date": "2018-05-16T00:00:00.0000000+02:00"
If you create a date directly on the server with the following code, the result will be:
"date": "2018-03-17T00:00:00+01:00".
To directly access the server, I use this method:
var document = new Document<dynamic>
{
Id = Guid.NewGuid().ToString("N"),
Content = new SomeObject
{
Date = DateTimeOffset.Now
}
};
The problem arises when the server-created-objects are synchronized to the CBL-DB.
Any dates created on the server which are parsed with the IDictionaryObject.GetDate - method will always result in DateTimeOffset.MinValue.
A possible workaround for this bug is this:
DateTimeOffset.Parse(result.GetString(i.Key))
I’m using CouchbaseNetClient 2.5.10 and Couchbase.Lite 2.0.0.1