fix(filter)!: convert a DateTimeOffset filter value to UTC - #143
Merged
Merged
Conversation
pdevito3
force-pushed
the
fm/qk-breaking-datetimeoffset-utc
branch
from
October 1, 2026 21:47
8cce9b3 to
d5cc442
Compare
A DateTimeOffset literal kept its offset, and only a parameter went to UTC, because Npgsql accepts a DateTimeOffset parameter only with offset 0. Convert every DateTimeOffset value to UTC, so the literal and the parameter paths give the same value. The instant does not change. BREAKING CHANGE: a DateTimeOffset filter value is now in UTC also when ParameterizeFilterValues is off. The expression text and the offset of the value change. The instant stays the same.
pdevito3
force-pushed
the
fm/qk-breaking-datetimeoffset-utc
branch
from
October 2, 2026 20:00
d5cc442 to
4807fff
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For later consideration in a major version. Do not merge now. #134 restored the v1.14.2 offset to keep v1.x compatible (restore commit
7198ac2). This PR re-appliesea5cc66for the default path. The captain decides on this PR separately.Summary
ToParameterOffsetis removed. EveryDateTimeOffsetvalue goes to UTC, with or withoutParameterizeFilterValues.v1.14.2 behavior (and main)
A
DateTimeOffsetliteral keeps its offset. On main, only a parameter (withParameterizeFilterValueson) goes to UTC, because Npgsql accepts aDateTimeOffsetparameter only with offset 0.New behavior
Every
DateTimeOffsetvalue is in UTC. The instant does not change. Only the offset and the ticks in the expression change.Example
x => (x.SpecificDate == new Nullable1(new DateTimeOffset(637922304030000000, 01:00:00)))`.x => (x.SpecificDate == new Nullable1(new DateTimeOffset(637922268030000000, 00:00:00)))`.Justification
The literal path and the parameter path must give the same value for the same input. One rule (always UTC) is simpler than a rule that depends on
ParameterizeFilterValues.Migration
None for database queries: the comparison uses the instant, and the result rows do not change. A caller that reads the expression text or the
Offsetof the value sees offset 0.README
The
DateTimeOffsetformat bullet now tells that QueryKit converts the value to UTC.Tests
These tests come back from main before #134, in unit
FilterParserTests. The expected value is in UTC again:can_handle_datetime_comparison_with_timezonecan_handle_datetime_comparison_with_timezone_anothercan_handle_datetime_comparison_with_negative_timezonecan_handle_datetime_comparison_with_timezone_no_minutesThe integration test
date_time_offset_value_with_offset_matches_same_instant(Postgres) does not change. It passes withParameterizeFilterValuesoff and on.dotnet test: 470 unit tests and 297 Postgres integration tests (Testcontainers) pass, 0 failures.Rebase on main
This branch is rebased on current main (#169). The rebase had no conflicts. The breaking change did not change.