Skip to main content
Version: Current (v7.0.0-beta.3)

A string is dropped where a new date or time format can't show it

Detect​

  • In your schema: a string field that an if-then-else branch, an anyOf/oneOf option or a new schema prop gives a format of date, time, iso-time, date-time, datetime or iso-date-time it didn't have.
  • In your form data: a string such a field holds that its date or time input can't show, such as 'abcd'.
  • In your code: a theme picker, or a field or widget registered under a stock name such as DateWidget, that shows such strings.

Change​

A string is dropped where a branch, an option or a new schema prop gives its field a date or time format (see formatChangeClears()) whose input can't show it, rather than submitted unseen (#5944). With oneOf options declaring p: { type: 'string' } and p: { type: 'string', format: 'date' } and the data { p: 'abcd' }, select the second. Before: { p: 'abcd' }. After: {}.

A field keeps the string where its uiSchema names a ui:widget that shows the string, as every one but a date or time one does, or a text ui:inputType, or where a field of your own renders it, itself or as part of what holds it. That doesn't hold on a switch between options of a field that holds a string itself or an array, since the switch reads no uiSchema.

What an input shows is what core's does. A theme's picker that shows more, or a field or widget you register under a stock name, such as DateWidget, is taken to show no more than that. If it shows any string, give it in the uiSchema, as a component or under another name:

const uiSchema = {
- p: { 'ui:widget': 'DateWidget' },
+ p: { 'ui:widget': MyDatePicker },
};

Verify​

  • A string the date or time input can't show is gone from the data once the format applies, unless a widget you name shows it.

Also read: