Material-ui-pickers: Stange behavior when value is undefined in v3

Created on 26 May 2019  路  2Comments  路  Source: mui-org/material-ui-pickers

Environment

| Tech | Version |
| -------------------- | ------- |
| @material-ui/pickers | 3.0.0 |
| material-ui | 4.0.0 |
| React | 16.8 |

Steps to reproduce

Set initial value to "undefined".

Expected behavior

Input field: empty

Actual behavior

Input field: current day date is displayed.

Suggestion

Manage "undefined" value exactly as you do with "null" value.

And to be consistent with material-ui input fields, when "no date" is selected, the value should probably be "undefined" instead of "null" (current behavior).

Most helpful comment

@dmtrKovalenko I'de like to show an empty field in case of no date, is that possible?

All 2 comments

No, undefined will be parsed exactly as any other date value (like iso string, date object, etc)

@dmtrKovalenko I'de like to show an empty field in case of no date, is that possible?

Was this page helpful?
0 / 5 - 0 ratings