Skip to content

Conversation

@gdlcf88
Copy link
Contributor

@gdlcf88 gdlcf88 commented Oct 24, 2025

Close #24048

@maliming maliming self-requested a review October 26, 2025 02:25
@maliming maliming added this to the 10.2-preview milestone Oct 26, 2025
@maliming maliming changed the base branch from dev to rel-10.1 January 3, 2026 08:52
@maliming maliming changed the title Redo AbpDateTimeModelBinder to align with the current TZ Assume that the Unspecified datetime is user's local time zone. Jan 3, 2026
@maliming maliming changed the base branch from rel-10.1 to dev January 3, 2026 09:20
@maliming maliming requested a review from Copilot January 3, 2026 09:24
Copy link
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

This PR implements timezone-aware datetime handling for unspecified DateTime values by treating them as being in the user's local timezone and converting them to UTC. This closes issue #24048.

Key Changes

  • Created a new base class AbpDateTimeConverterBase<T> to consolidate common datetime conversion logic for System.Text.Json converters
  • Updated datetime converters (both System.Text.Json and Newtonsoft.Json) to detect unspecified DateTimeKind values and convert them from the user's timezone to UTC
  • Enhanced AbpDateTimeModelBinder to apply the same timezone conversion logic for model binding scenarios
  • Added comprehensive test coverage for the new timezone-aware datetime handling

Reviewed changes

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

Show a summary per file
File Description
ModelBindingController_Tests.cs Added three new test methods to verify timezone-aware datetime handling for simple, nullable, and complex type scenarios
ModelBindingController.cs Added four new controller action methods that return both the DateTimeKind and the formatted datetime value for testing purposes
AbpNullableDateTimeConverter.cs Refactored to inherit from the new AbpDateTimeConverterBase<DateTime?> class
AbpDateTimeConverterBase.cs New abstract base class that consolidates datetime reading, writing, and timezone-aware normalization logic
AbpDateTimeConverter.cs Refactored to inherit from the new AbpDateTimeConverterBase<DateTime> class
AbpDateTimeConverter.cs (Newtonsoft) Added timezone conversion logic in the Normalize method to handle unspecified datetime values
AbpDateTimeModelBinderProvider.cs Updated to inject ICurrentTimezoneProvider and ITimezoneProvider dependencies
AbpDateTimeModelBinder.cs Added timezone conversion logic for unspecified datetime values before normalization

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
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 8 out of 8 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@maliming maliming merged commit 634d805 into abpframework:dev Jan 3, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Submitted date times are interpreted as UTC, causing TZ inconsistency

2 participants