I recently updated from crystal-db 0.5.1
and crystal-pg 0.16.1
to crystal-db 0.6.0
and crystal-pg 0.18
. This caused the following change in the application behavior, which appears to be a bug.
Behavior with the newer versions of these packages
(1) I send an integer = 1565713800000 milliseconds since epoch to the server as part of JSON. This equals 12:30pm US Eastern time on August 13.
(2) On server I use timecreated: {type: Time?, converter: Time::EpochMillisConverter}
as part of JSON.mapping to read this value.
(3) I insert the read value (which is now of type Time) into Postgres timestamptz
column. The time in postgres shows up as 4:30pm US Eastern time. Postgres may be saving the timestamp, but in psql it displays the time locally (which is US Eastern time for me).
(4) As expected, when I get this value out again on another page, it is now 4 hours ahead of what I expect.
I reverted crystal-pg to 0.16.1 (which automatically changed crystal-db to 0.5.1). The behavior is as expected. When I send the integer = 1565713800000 milliseconds, and follow the above steps, the time in Postgres shows as 12:30pm US Eastern time on August 13.
What is strange is that both with the new as well as the old versions of these packages, the correct time gets inserted in postgres, when I use Time.now
.
If this is a bug, I am not sure whether this is a problem with crystal-db
or with crystal-pg
.