Exposed: Date store in a postgres DATE column gives back the incorrect date

Created on 5 Jun 2018  路  2Comments  路  Source: JetBrains/Exposed

Hi all, got a bit of an odd one here:

Hey guys, got a bit of an odd one here:

I've got an exposed date() column (postgres Date) and I can store dates correctly in it.
However, when I read from the database, it seems to create a DateTime with a one hour offset:

Please note that we manage db migrations via Flyway and we are not using a datetime with timezone as the storage, we are using a postgres date()

Ie, I store 2018-04-27 in the db. the generated sql looks correct and the correct values is stored in postgres.

When I read it, it gets read as 2018-04-27T00:00:00.000+01:00 which is 2018-04-26.

bug datetime

Most helpful comment

All 2 comments

Out of curiosity:
date() yields a Column<DateTime>. On the sql side date() becomes a DATE type, which is just a date like a birthdate, i.e. without a time part and without a timezone. Whereas DateTime is related to a timezone. Isn麓t that a mismatch?
Wouldn麓t something like LocalDate not a better mapping?

Was this page helpful?
0 / 5 - 0 ratings