You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As you can see in the type mapping docs, DateTime is by default mapped to timestamp without time zone. When reading that back from the database, you get instances with Kind=Unspecified.
You can change your database column's type to timestamp with time zone by specifying that (see the general EF Core docs). This will give you back DateTime instances with Kind=Local.
If you know you're always storing UTC values and want to have DateTime instances with Kind=UTC, you can set up value conversion to set the Kind manually. Another option is simply to ignore the type and treat DateTime with Kind=Unspecified as UTC.
Am closing as I don't see anything actionable on Npgsql's side, but we can continue discussing this (and eventually reopen if we decide that any change is appropriate).
Activity
roji commentedon Oct 14, 2019
As you can see in the type mapping docs, DateTime is by default mapped to
timestamp without time zone. When reading that back from the database, you get instances with Kind=Unspecified.You can change your database column's type to
timestamp with time zoneby specifying that (see the general EF Core docs). This will give you back DateTime instances with Kind=Local.If you know you're always storing UTC values and want to have DateTime instances with Kind=UTC, you can set up value conversion to set the Kind manually. Another option is simply to ignore the type and treat DateTime with Kind=Unspecified as UTC.
Am closing as I don't see anything actionable on Npgsql's side, but we can continue discussing this (and eventually reopen if we decide that any change is appropriate).