datetime

type DatetimeField = {
  label: string
  name: string
  type: 'string'
   /** See https://tina.io/docs/extending-tina/overview/ for customizing the UI **/
  ui?: {
    dateFormat: string // eg 'YYYY MM DD'
    label?: string
    description?: string
    component?: FC<any> | string | null
    parse?: (value: string, name: string, field: F) => any
    format?: (value: string, name: string, field: F) => any
    validate?(
      value: string,
      allValues: any,
      meta: any,
      field: UIField<F, Shape>
    ): string | undefined | void  
  }
}

The return value for a datetime is in ISO string format

You can add a timepicker to the date UI by supplying the `ui.timeFormat` property

{
  type: "datetime",
  name: "date",
  label: "Date",
  ui: {
    timeFormat: "HH:mm"
  },
},

Last Edited: July 27, 2021

Stay in touch 👉