Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ public void TestDefaultPropertyNameConverterToMutableDocument()
StringValue = "Test Value"
};

Settings.PropertyNameConverter = null;

var mutableDocument = simpleObject.ToMutableDocument();

var result = mutableDocument?.Keys.Contains("stringValue");
Expand Down
6 changes: 5 additions & 1 deletion src/Couchbase.Lite.Mapping/ObjectExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ static void AddDictionaryValue(ref Dictionary<string, object> dictionary,
}
else if (propertyType == typeof(DateTime) || propertyType == typeof(DateTime?))
{
dictionary[propertyName] = new DateTimeOffset((DateTime)propertyValue);
DateTime dateTimePropertyValue = (DateTime)propertyValue;
DateTimeOffset dateTimeOffset = dateTimePropertyValue.ToUniversalTime() <= DateTimeOffset.MinValue.UtcDateTime
? DateTimeOffset.MinValue
: new DateTimeOffset(dateTimePropertyValue);
dictionary[propertyName] = dateTimeOffset;
}
else if (!propertyType.IsSimple() && !propertyType.IsEnum && propertyType.IsClass && propertyValue != null)
{
Expand Down