Question about `timestamp` from `koltin-datetime` ...
# exposed
k
Question about
timestamp
from
koltin-datetime
extension - Upon checking it’s implementation I noticed it uses the current time zone to create a local date time, before storing that in db. Is this correct? I think it could potentially do a time shift, if db and api are used in different timezones? Am I missing something?
g
This is a common problem in the wider Java community where the DB is not running in UTC! The 'assumption' is that the caller and the DB instances are both running in UTC. The only other option I've seen is to NOT use the DB's Timestamp and use Instant toString() which is adequately sortable :(
k
TIL. Yeah, making sure that both api and db works in UTC is good way, although not bullet proof. I'm interested by the way exposed handles the "Instant" type, which is meant to be a moment in time, while it gets converted to system's timezone on the way
v
This is a problem of exposed, I think.
Instant means point in time. LocalDateTime can't be used to describe point in time in any situation.