fix(filter): read a date in a list with the invariant culture - #173
Merged
Merged
Conversation
A list value for DateOnly, TimeOnly, and DateTimeOffset used the current culture. Under ar-SA the list threw FormatException. Under th-TH and fa-IR the list read 2024-01-15 with another calendar and matched no row. A single comparison already used the invariant culture.
pdevito3
force-pushed
the
fix/invariant-culture-list-dates
branch
from
October 2, 2026 20:13
dec4194 to
39837d7
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.
Summary
A list value (
^^ [...]) forDateOnly,TimeOnly, andDateTimeOffsetnow reads with the invariant culture. A single comparison already did this. Before, the list used the culture of the thread.The cultures with a real bug use a calendar that is not Gregorian: ar-SA (Um Al-Qura), th-TH (Thai Buddhist), and fa-IR, prs-AF, ps-AF (Persian). The ISO form with
Tis not affected. A form withoutT, for example2024-01-15or2024-01-15Z, is affected:Date ^^ [2024-01-15]beforeFormatExceptionTimeOnlyshowed no difference in any culture. Its change is for consistency only.DateTimeOffsetkeeps the UTC conversion from #143, which is already onv2. This PR changes only the culture.#116 changes the same
DateTimeOffsetline and must rebase on this PR.Call sites not changed
TimeSpan.Parse(value)in the list: the invariant culture rejects a comma fraction such as01:02:03,5, which works under de-DE today. No culture showed a bug for this type, so a change is a break with no gain.bool,Guid,char,Enum, and theint.Parseof the fraction digits: these do not depend on the culture.decimal.TryParse(value, out _)in the literal check ofIsPropertyPath: this is the number grammar of fix(parser)!: parse numbers with the invariant culture only #121. It is a breaking change and stays out of this PR.Evidence
Proof from the
verify-querykitharness, labelsdateonly-list-{culture}anddateonly-list-{culture}-fixed. Memory and Postgres gave the same result.Date ^^ [2024-01-15]returned 0 rows. Under ar-SA, it threwFormatException.After: under each culture, the filter returned the row with the date 2024-01-15.
Tests, written first (TDD):
After:
dotnet test: 482 unit tests and 303 integration tests pass, 0 failures.Merge Danger
Door: two-way
Blast Radius: small
The change affects only a list value of these three types under a culture with a calendar that is not Gregorian. Before, those filters returned wrong rows or threw. In every other culture, the result is the same.