Skip to content

Fix DateTimeOffset Converter #2582#3077

Merged
VladislavAntonyuk merged 4 commits intomainfrom
fix-2582
Feb 8, 2026
Merged

Fix DateTimeOffset Converter #2582#3077
VladislavAntonyuk merged 4 commits intomainfrom
fix-2582

Conversation

@VladislavAntonyuk
Copy link
Copy Markdown
Contributor

@VladislavAntonyuk VladislavAntonyuk commented Feb 8, 2026

Description of Change

Instead of using current date time offset, we need to use offset of the parameter date

Linked Issues

PR Checklist

Additional information

@VladislavAntonyuk VladislavAntonyuk self-assigned this Feb 8, 2026
Copilot AI review requested due to automatic review settings February 8, 2026 13:26
@VladislavAntonyuk VladislavAntonyuk enabled auto-merge (squash) February 8, 2026 13:26
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes DateTimeOffsetConverter so ConvertBackTo computes the UTC offset based on the provided DateTime (so DST/seasonal offsets are correct), addressing #2582.

Changes:

  • Updated DateTimeOffsetConverter.ConvertBackTo to use TimeZoneInfo.*.GetUtcOffset(value) instead of current-time offsets.
  • Updated unit tests to validate offsets and to include offset in DateTimeOffset comparisons.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/CommunityToolkit.Maui/Converters/DateTimeOffsetConverter.shared.cs Computes offsets from the parameter DateTime to fix DST-dependent conversions.
src/CommunityToolkit.Maui.UnitTests/Converters/DateTimeOffsetConverterTests.cs Adjusts expected offsets and comparer to validate correct offset behavior (but includes environment-dependent cases).

Copilot AI review requested due to automatic review settings February 8, 2026 18:26
Copy link
Copy Markdown
Collaborator

@TheCodeTraveler TheCodeTraveler left a comment

Choose a reason for hiding this comment

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

Thanks Vlad!

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

@VladislavAntonyuk VladislavAntonyuk merged commit c288cfa into main Feb 8, 2026
10 checks passed
@VladislavAntonyuk VladislavAntonyuk deleted the fix-2582 branch February 8, 2026 18:45
@github-actions github-actions bot locked and limited conversation to collaborators Feb 10, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] DateTimeOffsetConverter calculates wrong offset

3 participants