Skip to content

Parse the built in ISO date format with the invariant culture - #1884

Merged
SimonCropp merged 1 commit into
mainfrom
fix-iso-date-parse-culture
Aug 29, 2026
Merged

SimonCropp merged 1 commit into
mainfrom
fix-iso-date-parse-culture

Conversation

@SimonCropp

Copy link
Copy Markdown
Member

Every TryParseExact in the date scrubber passed a null provider, so the built in ISO format was parsed with the ambient culture and its calendar, while DateFormatter writes with the invariant culture.

Under th-TH (Buddhist) 2023-08-29T10:11:12 parsed as Gregorian 1480, so the MinValue and MaxValue sentinels and the named date lookups stopped matching. Under ar-SA (UmAlQura) the parse failed outright and ISO timestamps were left unscrubbed, making snapshot content differ by machine with the default on ScrubDateTimes.

Formats registered through AddExtraDateTimeFormat keep parsing with the ambient culture: the test supplies both those formats and the values they match, and the default 'd' and 'h:mm tt' are culture specific by design.

Every TryParseExact in the date scrubber passed a null provider, so the built in
ISO format was parsed with the ambient culture and its calendar, while
DateFormatter writes with the invariant culture.

Under th-TH (Buddhist) 2023-08-29T10:11:12 parsed as Gregorian 1480, so the
MinValue and MaxValue sentinels and the named date lookups stopped matching.
Under ar-SA (UmAlQura) the parse failed outright and ISO timestamps were left
unscrubbed, making snapshot content differ by machine with the default on
ScrubDateTimes.

Formats registered through AddExtraDateTimeFormat keep parsing with the ambient
culture: the test supplies both those formats and the values they match, and the
default 'd' and 'h:mm tt' are culture specific by design.
@SimonCropp SimonCropp added this to the 33.0.0 milestone Aug 29, 2026
@SimonCropp
SimonCropp merged commit c1ce93d into main Aug 29, 2026
6 of 7 checks passed
@SimonCropp
SimonCropp deleted the fix-iso-date-parse-culture branch August 29, 2026 09:52
This was referenced Sep 12, 2026
This was referenced Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant