Renamed plugin @sanity/date-input
The Studio v2 plugin @sanity/date-input was renamed @sanity/rich-date-input. On Studio v3 and later, install and register the plugin directly.
This page describes a Studio v2 plugin
The rename warning that brought you here is printed by @sanity/date-input, which loads only through the Studio v2 parts system. If you're on Studio v3 or later, follow Studio v3 and later below. For most fields, the built-in date and datetime types are enough. @sanity/rich-date-input adds a timezone-aware datetime type and input component.
The plugin @sanity/date-input has been renamed to @sanity/rich-date-input to better reflect its purpose.
What should I do?
The steps depend on which major version of Sanity Studio you're running.
Studio v3 and later
- Install the package with
npm install @sanity/rich-date-input - Add
richDate()to thepluginsarray in your Studio configuration:
import {defineConfig} from 'sanity'
import {richDate} from '@sanity/rich-date-input'
export default defineConfig({
projectId: 'YOUR_PROJECT_ID',
dataset: 'production',
plugins: [richDate()],
})With the plugin registered, you can use richDate as a field type in your schema.
Studio v2
- Install the Studio v2 release of the package with
npm install @sanity/rich-date-input@2 - Remove the
@sanity/date-inputentry from thepluginsarray in yoursanity.json. - Add the
richDatetype definition from the plugin to your schema, for example:
import richDate from 'part:@sanity/form-builder/input/rich-date/schema'
// ...
export default createSchema({
name: 'mySchema',
types: [
//...
richDate
]
})