sanity icon indicating copy to clipboard operation
sanity copied to clipboard

Schema Date type dateFormat field should apply to queried data

Open redpwilliams opened this issue 1 year ago • 1 comments

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:

  1. Install moment and do the transformation ourselves. This is only useful if the user needs multiple conversions throughout their project.
  2. Write a utility function for small use cases. For limited use.

redpwilliams avatar Jan 25 '24 00:01 redpwilliams

This also references #2799. That appears to have been pre v3, so it has since been closed.

redpwilliams avatar Jan 25 '24 00:01 redpwilliams