I am writing a test case, the data returns contain a DateTime field
:
modified_at: Timex.now()
which has the value like this:
modified_at: ~U[2019-07-25 08:22:36.000000Z]
But Jason encoder encodes this value to a string:
"2019-07-25T08:22:36.000000Z"
In the test, when I assert the value ofmodified_at,
it gives me wrong microseconds value.
assert modified_at == DateTime.to_iso8601(~U[2019-07-25 08:22:36.000000Z]
It gives me this DateTime
"2019-07-25T08:22:35.855958Z"
It does not round off the microseconds value, and I can’t understand why it’s showing such behavior.
Any help will be much appreciated.
Thanks