Add Support for DateOnly type
Currently, GraphQL response is showing DateTimeFormat for date type columns.
If the value stored in the DB is 11-03-2017, graphql will show 11-03-2017T00:00:00Z.
@Aniruddh25, should we do this as well (Now, that we know how to do it and it will be easier to consume). Maybe we can take this up in a future milestone?
@abhishekkumams, makes sense - I wonder why is that the case isn't Date type mapped to HotChocolate Date? https://chillicream.com/docs/hotchocolate/v13/defining-a-schema/scalars#net-scalars
@abhishekkumams, makes sense - I wonder why is that the case isn't Date type mapped to HotChocolate Date? https://chillicream.com/docs/hotchocolate/v13/defining-a-schema/scalars#net-scalars
Nope, It's mapped to DateTime
@abhishekkumams,
I went back into the previous changes and found this reasoning in the commit: https://github.com/Azure/data-api-builder/commit/63d5ef24e3bb90057fed015caa1d81f222de232a:
- DateTime This is a bit of a tricky one.
DateTimetype is handled by HotChocolate asDateTimeOffset. Also, our db column type detection method givesDateTimefor allDate,DateTime, andDateTimeOffset. Meaning that while the user can define nonDateTimeOffsetcolumns, they will be interpreted asDateTimeOffsetand the gaps will be filled with 00:00:00 time and local offset. HotChocolate also provides us withDatetype. However, because all db column typesDate,DateTime, andDateTimeOffsetare detected asDateTimesystem types, we cannot make use of the HotChocolateDatetype as of now.
So, to solve this, we would need to look for alternative ways for db column type to system type detection method other than ADO.NET Db Data provider.
@ayush3797 is this duplicate or secondary to your date work?
@ayush3797 is this duplicate or secondary to your date work?
Its not.
@abhishekkumams i wonder if your work enabling SqlDbType SqlParameter work would help here. When reading the db schema from MsSql, are we able to parse out a specific SqlDbType? or are we still restricted to the limitations of DbType values as explained in Ani's quote
DateTime https://github.com/Azure/data-api-builder/commit/63d5ef24e3bb90057fed015caa1d81f222de232a This is a bit of a tricky one. DateTime type is handled by HotChocolate as DateTimeOffset. Also, our db column type detection method gives DateTime for all Date, DateTime, and DateTimeOffset. Meaning that while the user can define non DateTimeOffset columns, they will be interpreted as DateTimeOffset and the gaps will be filled with 00:00:00 time and local offset. HotChocolate also provides us with Date type. However, because all db column types Date, DateTime, and DateTimeOffset are detected as DateTime system types, we cannot make use of the HotChocolate Date type as of now.