Repository navigation
Format NpgsqlRange<T> bounds culture-invariantly in ToString and Parse - #6738
Open
EnesKartal wants to merge 1 commit into
Open
EnesKartal wants to merge 1 commit into
EnesKartal wants to merge 1 commit into
Conversation
Date/time bounds are written in ISO 8601. Fixes npgsql#6730
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
This branch has not been deployed
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.
NpgsqlRange<T>.ToString()formatted bounds with the current culture, so underde-DEanumrangeprinted as[1,5,2,25), and adaterangeprinted as[01.07.2026,04.07.2026], which PostgreSQL reads as other dates. This is what EF Core'sToQueryString()and parameter logs show (details in the issue).Bounds are now formatted with the invariant culture, and
DateTime,DateTimeOffset,DateOnlyandTimeOnlybounds use the round-trip format (O).There was no reply on the issue about the date format, so these behavior changes are worth a look. I'm happy to narrow the PR if you'd rather keep any of them out:
[07/01/2026,07/04/2026]becomes[2026-07-01,2026-07-04], andDateTimebounds keep their fraction digits. Anything that depends on the old text will see a difference.Parsenow uses the invariant culture too. I changed it soToStringoutput round-trips under any culture, which goes beyond what the issue asks for. As a result,Parseno longer accepts culture-specific text such as[1,5,2,25)underde-DE.DateTimebounds come back as local time. Round-tripping throughToStringandParsekeeps the instant, butKindchanges fromUtctoLocal, becauseDateTimeConverterconverts theZvalue to local time.Verification:
RangeTestson net10.0 against PostgreSQL 18 (92 passed, 1 skipped), with this commit rebased on currentmain. I didn't run the rest of the suite. The new tests run underde-DEand coverdecimal,DateTime,DateTimeOffset,DateOnlyandTimeOnly.Fixes #6730