Closed hyouuu closed 4 years ago
@0xTim any context on why this was closed? Was it resolved? cc @tanner0101
I'm guessing Swift's Date
only supports millisecond precision so that's why
I'm guessing Swift's
Date
only supports millisecond precision so that's why
Interesting - did some search and this shows that the millisecond precision might only happen with DateFormatter
& timeIntervalSince1970
, and using timeIntervalSinceReferenceDate
it would work properly - any way we can improve here? https://stackoverflow.com/questions/64594108/swift-precision-with-timeintervalsince1970
For example, a model has
updatedAt = 2018-04-06 17:18:32.185242+00
in postgres, and a route returns model.makeJSON(), then in the json content theupdatedAt
field has2018-04-06T17:18:32.185Z
, which lost the last 3 digits242
thus lost the precision.As a result, if I pass the
updatedAt
back from client to server to.filter("updatedAt", .greaterThan, passedBackDate)
, the result would still contain that entry since it's .185242 is greater than 185.I think there is no reason to omit 3 digits and we should just keep what is stored in database intact when converting to json.