admin管理员组

文章数量:1426810

Using this library: I want to add a date selector field and here in the documentation is says:

date: By default, an input[type=date] element is used;
date-time: By default, an input[type=datetime-local] element is used.

and they posted this picture, I want mine to look the same as the date one:

I use last version of Chrome, for the patibility issue.

I've try to write something like this:

date: {
       type: "date",
       title: "Date"
        }

but I got this error:

Unsupported field schema for field root_date: Unknown field type date.

Check this fiddle:

/

Using this library: https://github./mozilla-services/react-jsonschema-form I want to add a date selector field and here in the documentation is says:

date: By default, an input[type=date] element is used;
date-time: By default, an input[type=datetime-local] element is used.

and they posted this picture, I want mine to look the same as the date one:

I use last version of Chrome, for the patibility issue.

I've try to write something like this:

date: {
       type: "date",
       title: "Date"
        }

but I got this error:

Unsupported field schema for field root_date: Unknown field type date.

Check this fiddle:

https://jsfiddle/bogdanul11/69z2wepo/91003/

Share Improve this question asked Nov 9, 2017 at 14:31 Tatu BogdanTatu Bogdan 5962 gold badges11 silver badges29 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 4

You should define the json shema as following:

"datetime": { // whatever name you want
  "type": "string", //Attention!
  "format": "date-time"
},

instead of what you did:

date: {
  "type": "date",
  "title": "Date"
}

The react-jsonschema-form library provides really nice playground: https://mozilla-services.github.io/react-jsonschema-form/

本文标签: javascriptHow to add type date for reactjsonschemaformStack Overflow