ChilliCream / graphql-platform

Welcome to the home of the Hot Chocolate GraphQL server for .NET, the Strawberry Shake GraphQL client for .NET and Banana Cake Pop the awesome Monaco based GraphQL IDE.
https://chillicream.com
MIT License
5.14k stars 732 forks source link

GraphQL DateTime scalar should throw when no offset is specified #6276

Closed glen-84 closed 1 month ago

glen-84 commented 1 year ago

Is there an existing issue for this?

Product

Hot Chocolate

Describe the bug

A user can currently specify a DateTime without an offset, which should be considered invalid input.

This leads to confusing behaviour, where the server's offset is used by default.

Steps to reproduce

Use a DateTime filter like:

articles(
    where: { publishedAt: { eq: "2022-06-08T16:44:00" } }
)

With a type converter like:

.AddTypeConverter<DateTimeOffset, DateTime>(
    dateTimeOffset => dateTimeOffset.UtcDateTime)

Expect the SQL to use 16:44:00, but it uses 14:44:00, since the server's offset is +02:00.

Relevant log output

No response

Additional Context?

https://github.com/ChilliCream/graphql-platform/issues/2604#issuecomment-730189298

Version

13.2.1

michaelstaib commented 1 month ago

Test Cases are specified here: graphql-scalars.com/date-time