Skip to content

Should LocalDate be stored by default in UTC? #886

@ps-feng

Description

@ps-feng

When using date as a table column (Column<LocalDate>) the value saved to the DB depends on the timezone of the system. This means something like

SomeTable.insert {
    this[date] = LocalDate.parse("2020-01-01")
}

will be non-deterministic. The same code will insert a different value depending on the machine where it's run.

My suggestion would be to make dates use UTC by default.

EDIT: it seems this happened because I had created the column via regular SQL as a timetamptz (Postgres) so there was a mismatch. Even though JavaLocalDateColumnType's SQL type is DATE it continued to work, albeit incorrectly, not sure if this should be a bug or not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions