
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeThe issue you're experiencing isn't due to a change in how the dateFormat option works - there's actually a mismatch between what you're expecting and what's happening.
According to the official Sanity documentation for the date type, the date type should store values as date-only strings in "YYYY-MM-DD" format, not as full ISO datetime strings with time components.
The fact that you're seeing "2021-04-01T07:00:00.000Z" (with time) instead of "2021-04" or "2021-04-01" suggests you might actually be using the datetime type instead of the date type, or there's a type mismatch somewhere in your schema.
The dateFormat option only controls how the date is displayed in the Studio UI - it doesn't change what gets stored in your dataset. The stored value for a date type should always be "YYYY-MM-DD" format.
Your older documents with "2021-04" are storing incomplete date strings, which isn't standard for Sanity's date type. This might have been from a custom input or a different field type.
Double-check your schema - Make sure you're using type: 'date' and not type: 'datetime':
{
type: 'date', // NOT 'datetime'
name: 'date',
options: {
dateFormat: 'YYYY-MM' // This only affects display, not storage
}
}If you truly need year-month only storage, you'll need to use a custom input component or store it as a string type, since the native date type will always store the full "YYYY-MM-DD" format.
Check your queries/frontend - The datetime values you're seeing might be coming from a different field or being transformed somewhere in your data pipeline.
The dateFormat: 'YYYY-MM' option will make the Studio display the date as "2021-04", but the stored value will still be "2021-04-01" (with a day component defaulting to 01).
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store