Allow up to 9 fractional second digits for input to Date/Time scalars#9347
Merged
Allow up to 9 fractional second digits for input to Date/Time scalars#9347
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates HotChocolate’s date/time scalar input handling to accept up to 9 fractional second digits (nanosecond-style input) for DateTime, LocalDateTime, and LocalTime, while keeping output precision capped by .NET tick resolution.
Changes:
- Increased
DateTimeOptions.DefaultInputPrecisionfrom 7 to 9 and updated validation/resources accordingly. - Extended the generated regex validators in the scalar implementations to support 8 and 9 fractional second digits.
- Updated scalar unit tests to cover the new accepted/invalid fractional-second behaviors.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/HotChocolate/Core/test/Types.Tests/Types/Scalars/LocalTimeTypeTests.cs | Expands regex/pattern expectations and valid/invalid input cases to include 8–9 digits. |
| src/HotChocolate/Core/test/Types.Tests/Types/Scalars/LocalDateTimeTypeTests.cs | Expands regex/pattern expectations and valid/invalid input cases to include 8–9 digits. |
| src/HotChocolate/Core/test/Types.Tests/Types/Scalars/DateTimeTypeTests.cs | Expands regex/pattern expectations and valid/invalid input cases to include 8–9 digits. |
| src/HotChocolate/Core/src/Types/Types/Scalars/LocalTimeType.cs | Adds LocalTimeRegex8/9 and updates precision switch to select them. |
| src/HotChocolate/Core/src/Types/Types/Scalars/LocalDateTimeType.cs | Adds LocalDateTimeRegex8/9 and updates precision switch to select them. |
| src/HotChocolate/Core/src/Types/Types/Scalars/DateTimeType.cs | Adds DateTimeRegex8/9 and updates precision switch to select them. |
| src/HotChocolate/Core/src/Types/Types/Scalars/DateTimeOptions.cs | Raises default/maximum input precision to 9; keeps output max at 7. |
| src/HotChocolate/Core/src/Types/Properties/TypeResources.resx | Updates localized error text for input precision max from 7 to 9. |
| src/HotChocolate/Core/src/Types/Properties/TypeResources.Designer.cs | Updates generated XML doc string to reflect new localized text. |
Files not reviewed (1)
- src/HotChocolate/Core/src/Types/Properties/TypeResources.Designer.cs: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 10 changed files in this pull request and generated no new comments.
Files not reviewed (1)
- src/HotChocolate/Core/src/Types/Properties/TypeResources.Designer.cs: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced May 1, 2026
Open
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 of the changes (Less than 80 chars)