HappYness-Project / Happy-EventSourcing

Event sourcing
10 stars 1 forks source link

Change Read Db side | DateTime timestamp Should be UTC timezone. #95

Closed hyunbin7303 closed 1 year ago

hyunbin7303 commented 1 year ago

image

In current Datetime, it doesn't use UTC Time zone and postgres (since 6.0) changes to datetime field to be configured with Utc only.

Ref

In many cases, it makes sense to store UTC timestamps in the database. To do this, migrate your timestamp without time zone columns to timestamp with time zone (see migration notes below), and always use either DateTime with Kind=Utc or DateTimeOffset with offset 0. If using NodaTime (recommended), use either Instant or ZonedDateTime with time zone UTC. To store non-UTC timestamps, use DateTime with Kind=Unspecified and add explicit configuration to your properties to be timestamp without time zone. If using NodaTime (recommended), use LocalDateTime (no explicit column configuration is required).

https://www.npgsql.org/efcore/release-notes/6.0.html?tabs=annotations#timestamp-rationalization-and-improvements

We still can use the Datetime but using UTC time seems more desirable.

Todo