The problem seemed to be internal to the tests only and does not affect actual roundtrip values. this is because reading values directly from Bson (what we do in the tests) is not what actually runs with the F# Bson mapper (Entity -> JSON -> Bson -> JSON -> Entity).
Fixed this by applying the same consistent conversion from Bson.readDate as well:
Before
module Bson =
/// Reads a field from a BsonDocument as DateTime
let readDate (key: string) (doc: BsonDocument) =
doc.[key].AsDateTime
After
module Bson =
/// Reads a field from a BsonDocument as DateTime
let readDate (key: string) (doc: BsonDocument) =
let date = doc.[key].AsDateTime
if date.Kind = DateTimeKind.Local
then date.ToUniversalTime()
else date
fixed #21
The problem seemed to be internal to the tests only and does not affect actual roundtrip values. this is because reading values directly from
Bson
(what we do in the tests) is not what actually runs with the F# Bson mapper (Entity -> JSON -> Bson -> JSON -> Entity).Fixed this by applying the same consistent conversion from
Bson.readDate
as well: BeforeAfter