sanity
sanity copied to clipboard
Schema Date type dateFormat field should apply to queried data
Is your feature request related to a problem? Please describe.
We can set the format of a Date object in the studio with dateFormat
, but when calling it using a GROQ query, it is always returned in its ISO-8601 format, as described in the docs](https://www.sanity.io/docs/date-type).
Describe the solution you'd like
The dateFormat
should be - or at least have an option to be - respected for the GROQ call. In essence, the way the date is formatted in the studio should be the way it is presented in the query.
Describe alternatives you've considered There are two alternatives:
-
Install
moment
and do the transformation ourselves. This is only useful if the user needs multiple conversions throughout their project. - Write a utility function for small use cases. For limited use.
This also references #2799. That appears to have been pre v3, so it has since been closed.