Skip to content

Allow up to 9 fractional second digits for input to Date/Time scalars#9347

Merged
glen-84 merged 2 commits intomainfrom
gai/allow-9-digit-input
Mar 10, 2026
Merged

Allow up to 9 fractional second digits for input to Date/Time scalars#9347
glen-84 merged 2 commits intomainfrom
gai/allow-9-digit-input

Conversation

@glen-84
Copy link
Copy Markdown
Member

@glen-84 glen-84 commented Mar 10, 2026

Summary of the changes (Less than 80 chars)

  • Allow up to 9 fractional second digits for input to Date/Time scalars.

Copilot AI review requested due to automatic review settings March 10, 2026 08:58
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.DefaultInputPrecision from 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.

Comment thread src/HotChocolate/Core/src/Types/Types/Scalars/DateTimeOptions.cs
Comment thread src/HotChocolate/Core/src/Types/Types/Scalars/DateTimeOptions.cs
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

@glen-84 glen-84 merged commit cda9fba into main Mar 10, 2026
127 checks passed
@glen-84 glen-84 deleted the gai/allow-9-digit-input branch March 10, 2026 09:23
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