Details
-
Improvement
-
Resolution: Done
-
Neutral
-
None
-
-
Empty show more show less
-
Yes
-
HL & LD 26
-
2
Description
Our GraphQL formats Date(Time) always into yyyy-mm-dd format. We need to support both Date and DateTime.
Plan of action - based on conversation in comments
- Introduce DateTime scalar which outputs values in 8601 ISO format: yyyy-mm-ddThh:mm:ss:sssZ
- Change the system (metadata) properties defined by us to be DateTime
- Keep the current ContentType "Date" properties as is and have the generated GraphQL types be of scalar "Date" and output yyyy-mm-dd format. This is logical because ContentType-based app also renders a Date picker (not a Date & Time picker)
One corner case we should document:
If one decides to decorate CT generated app and enables time picker, then he/she should also decorate the respective GraphQL definition and set the type of the field to DateTime.
In the future we plan to add a DateTime property type to ContentTypes system, which will then result in Date Time picker in the app and DateTime output in GraphQL.
Previous Ideas
We have a couple of options here:
- specify another scalar type, e.g. DateTime
- introduce a new argument for Date field called format which would take string parameter with requested format.
- always return date in DateTime format.
Option #2 seems most flexible - devs would not need to hassle with datetime formatting on the client and would get exactly what they want (which imo is the GraphQL way).
Checklists
Attachments
Issue Links
- mentioned in
-
Page Loading...