jhipster / jdl-studio

JDL Studio is an online JHipster Domain Language visual editor
https://start.jhipster.tech/jdl-studio/
Apache License 2.0
405 stars 114 forks source link

Replace ZonedDateTime fields by Instant #34

Closed cbornet closed 6 years ago

cbornet commented 7 years ago

We shouldn't encourage to use ZonedDateTime.

SanatbekMatlatipov commented 3 years ago

Why did you change it to Instant? Because I am also facing issues with ZonedDateTime. When I generate my jdl entity fields as ZonedDateTime, it is creating as "timestamp" in the PostgreSQL table, but I expected "timestampz" to make it work properly

cbornet commented 3 years ago

@SanatbekMatlatipov timestampz won't preserve the ZoneID (eg. Europe/Paris) but only the ZoneOffset (+0200). If you're not sure which time type to use, you should probably use Instant which is appropriate for any value which is a timestamp. ZonedDateTime may be used for times that represent schedule time. Eg. start of a meeting in the future which would be the same even if the DST rules change. We currently don't have good support for ZonedDateTime in SQL since we store a timestamp and lose the ZoneId. IMO the correct way to do it should be to have two fields stored : a timestamp for the local datetime and a string for the ZoneID. I'll see if I have time to do it for v7. Anyway for your use case and for the one in jdl-studio, use Instant.