Skip to content

Use the invariant culture when parsing JSON TimeOnly values - #39069

Merged
AndriySvyryd merged 1 commit into
dotnet:mainfrom
ilkertskn:fix/scaffolding-invariant-culture-parsing
Sep 22, 2026
Merged

AndriySvyryd merged 1 commit into
dotnet:mainfrom
ilkertskn:fix/scaffolding-invariant-culture-parsing

Conversation

@ilkertskn

Copy link
Copy Markdown
Contributor

SqliteDatabaseModelFactory and SqlServerDatabaseModelFactory parsed DateTime, DateOnly, TimeOnly and DateTimeOffset default value literals with the current culture. Under cultures whose default calendar is not Gregorian (e.g. ar-SA) an ISO date such as '1968-10-23' fails to parse and the default value is silently dropped from the scaffolded model. The same applies to the Sqlite CLR type inference over min/max values.

SqliteJsonTimeOnlyReaderWriter is aligned with the other Sqlite JSON reader/writers, which already read and write with the invariant culture.

  • [x ] I've read the guidelines for contributing and seen the walkthrough
  • [x ] I've posted a comment on an issue with a detailed description of how I am planning to contribute and got approval from a member of the team
  • [x ] The code builds and tests pass locally (also verified by our automated build checks)
  • [x ] Commit messages follow this format:
        Summary of the changes
        - Detail 1
        - Detail 2

        Fixes #bugnumber
  • Tests for the changes have been added (for bug fixes / features)
  • [x ] Code follows the same patterns and style as existing code in this repo

@AndriySvyryd

Copy link
Copy Markdown
Member

This is mostly a duplicate of #38959.
Just keep the changes for SqliteJsonTimeOnlyReaderWriter

The other Sqlite JSON reader/writers (DateTime, DateTimeOffset, decimal)
and the core JsonTimeOnlyReaderWriter already parse and format with
CultureInfo.InvariantCulture; align the TimeOnly one with them.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@ilkertskn
ilkertskn force-pushed the fix/scaffolding-invariant-culture-parsing branch from 877282a to 5a6bf4e Compare September 22, 2026 22:20
@ilkertskn

Copy link
Copy Markdown
Contributor Author

done. i ve kept only the changes for SqliteJsonTimeOnlyReaderWriter

@AndriySvyryd AndriySvyryd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution!

@AndriySvyryd AndriySvyryd changed the title Use the invariant culture when parsing scaffolded date and time literals Use the invariant culture when parsing JSON TimeOnly values Sep 22, 2026
@AndriySvyryd
AndriySvyryd merged commit ce3905a into dotnet:main Sep 22, 2026
19 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Sep 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants