Skip to content

Changes to DateTime mapping - #1940

Merged
roji merged 1 commit into
npgsql:devfrom
roji:datetime-changes
May 20, 2018
Merged

roji merged 1 commit into
npgsql:devfrom
roji:datetime-changes

Conversation

@roji

@roji roji commented May 19, 2018 •

Copy link
Copy Markdown
Member
  1. DateTime is always sent as timestamp by default, regardless of its kind. You can still specify NpgsqlDbType.TimestampTz, in which case local DateTime gets converted to UTC before sending.

  2. When reading timestamptz as a DateTimeOffset, the machine local offset will be used. Previously a DateTimeOffset in UTC was returned.

  3. It is no longer possible to read or write DateTimeOffset as timestamp, only as timestamptz.

@roji roji added this to the 4.0 milestone May 19, 2018
@roji
roji requested a review from YohDeadfall May 19, 2018 16:18
@roji

roji commented May 19, 2018

Copy link
Copy Markdown
Member Author

Hey @YohDeadfall, can you please give this a thorough review to make sure everything makes sense?

@YohDeadfall

Copy link
Copy Markdown
Contributor

Sure, will do it tomorrow.

1. Datetime is *always* sent as timestamp by default, regardless of its
kind. You can still specify `NpgsqlDbType.TimestampTz`, in which case
local `DateTime` gets converted to UTC before sending.

2. When reading timestamptz as a DateTimeOffset, the machine local
 offset will be used. Previously a DateTimeOffset in UTC was returned.

3. It is no longer possible to read or write DateTimeOffset as
timestamp, only as timestamptz.
@roji
roji force-pushed the datetime-changes branch from da7bd06 to 6cbd6b2 Compare May 20, 2018 09:18
@roji roji self-assigned this May 20, 2018

@YohDeadfall YohDeadfall left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thanks!

Comment thread doc/release-notes/4.0.md

## Breaking changes from 3.2

> [!CAUTION]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I think that it would be better to make it bold and add two spaces after for a line break.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you seen what the red caution box looks like in the rendered site? It looks quite "bold" already I think...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Red box? Is it visible only on the site?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. This is a special syntax for docfx (our documentaton generation system) which generates a red box like you can see on the current release notes.

Comment thread doc/release-notes/4.0.md
> 2. When reading `timestamptz` as a `DateTimeOffset`, the machine local offset will be used. Previously a `DateTimeOffset` in UTC was returned.
> 2. It is no longer possible to read or write `DateTimeOffset` as `timestamp`, only as `timestamptz`.

> [!CAUTION]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Same here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants