datetime
Typetype DatetimeField = {label: stringname: stringtype: 'string'list?: boolean// See https://tina.io/docs/extending-tina/overview/ for customizing the UIui?: {dateFormat: string // eg 'YYYY MM DD'label?: stringdescription?: stringcomponent?: FC<any> | string | nullparse?: (value: string, name: string, field: F) => anyformat?: (value: string, name: string, field: F) => anyvalidate?(value: string,allValues: any,meta: any,field: UIField<F, Shape>): string | undefined | void}}
The return value for a datetime is in ISO string format
Tina will generate the appropriate component depending on the configuration provided.
{type: 'datetime',name: 'date',label: 'Date'}
You can customize the format that the date field use by customizing the dateFormat & parse properties.
{label: "Date",name: "date",type: "datetime",ui: {dateFormat: 'YY-MM-DD',parse: (value) => value && value.format('YY-MM-DD'),},}
You can add a timepicker to the date UI by supplying the ui.timeFormat property
{label: "Date",name: "date",type: "datetime",ui: {timeFormat: "HH:mm"},}
Last Edited: September 12, 2024
© TinaCMS 2019–2024