JSPM

@sanity/rich-date-input

0.133.0-realtime-block-editor.b0c02255
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 946
  • Score
    100M100P100Q108311F
  • License MIT

Date/time input components for Sanity form builder

Package Exports

  • @sanity/rich-date-input
  • @sanity/rich-date-input/schema

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@sanity/rich-date-input) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@sanity/rich-date-input

A richer date/time type and input component for Sanity form builder

Usage

  • sanity install @sanity/rich-date-input
  • In your schema:
    import richDate from 'part:@sanity/form-builder/input/rich-date/schema'
    
    // ...
    export default createSchema({
      name: 'mySchema',
      types: [
        //...
        richDate
      ]
    })
    

Typical data output:

{
  _type: 'richDate',
  local: '2017-02-21T10:15:00+01:00',
  utc: '2017-02-12T09:15:00Z',
  timezone: 'Europe/Oslo',
  offset: 60
}

Options

This component accepts the following options via the Sanity schema:

options.dateFormat || 'YYYY-MM-DD'
options.timeFormat || 'HH:mm'
options.calendarTodayLabel || 'Today'
options.timeStep || 15
options.inputUtc || false
options.inputDate || true
options.inputTime || true
options.placeholderDate || moment().format(options.dateFormat)
options.placeholderTime || moment().format(options.timeFormat)