Skip to content

Fix DateTimeOffset.DateTime UTC bug#7349

Merged
Aaronontheweb merged 2 commits into
akkadotnet:devfrom
Arkatufus:Fix-DateTimeOffset.Date-bug
Sep 30, 2024
Merged

Fix DateTimeOffset.DateTime UTC bug#7349
Aaronontheweb merged 2 commits into
akkadotnet:devfrom
Arkatufus:Fix-DateTimeOffset.Date-bug

Conversation

@Arkatufus

Copy link
Copy Markdown
Contributor

Fixes https://github.com/akkadotnet/akka.net/blame/554086ccba07338194aca2a1eb8e0f9d801973b7/src/core/Akka.Persistence/Eventsourced.cs#L221

  1. It uses DateTimeOffset.Date which strips the time portion of the DateTime struct
  2. DateTimeOffset.DateTime returns a DateTime object with DateTimeKind.Unspecified and we need DateTimeKind.Utc

Changes

Add a new property in ITimeProvider interface that returns a DateTime.UtcNow

Checklist

For significant changes, please ensure that the following have been completed (delete if not relevant):

@Aaronontheweb Aaronontheweb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@Aaronontheweb Aaronontheweb enabled auto-merge (squash) September 30, 2024 18:26
@Aaronontheweb Aaronontheweb merged commit 33fd92d into akkadotnet:dev Sep 30, 2024
Arkatufus added a commit to Arkatufus/akka.net that referenced this pull request Oct 3, 2024
Aaronontheweb pushed a commit that referenced this pull request Oct 3, 2024
* Revert "Fix unit tests related to the Persistence DateTime bug (#7352)"

This reverts commit f5c4e63.

* Revert "Fix DateTimeOffset.DateTime UTC bug (#7349)"

This reverts commit 33fd92d.
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