Npgsql.FSharp icon indicating copy to clipboard operation
Npgsql.FSharp copied to clipboard

`RowReader.dateTime` should return `DateTimeKind.Utc`

Open peterhirn opened this issue 4 years ago • 0 comments

I think reader.dateTime should always return dates with DateTimeKind.Utc. Otherwise this leads to problems downstream as eg. Json serialization will not append 'Z' to the string which will then be considered local-time by browsers and prevent correct conversion to actual local time.

Alternatively an additional function dateTimeUtc could be added.

Workaround

type RowReader with
    member this.dateTimeUtc(column: string) : DateTime =
        DateTime.SpecifyKind(this.dateTime column, DateTimeKind.Utc)

peterhirn avatar Jan 09 '22 18:01 peterhirn