React-datepicker: How to set null

Created on 19 Aug 2017  路  4Comments  路  Source: Hacker0x01/react-datepicker

I have an instance where a value is null. Is there a way to set when the date is null?

Most helpful comment

I have some forms with date fields. For an "empty" form, this field is null. What I want to do is to have a date picker that shows nothing or a placeholder like input controls.

At the moment, I get an error when the value is null so I use moment(). The concern however is that it is not possible to know whether the value is actually set or not since the picker always displays something.

Fields like dateOfBirth and dateJoined appear to have values when the value is actually null.

All 4 comments

Please provide more info, why you need this, what is yout use case?

I have some forms with date fields. For an "empty" form, this field is null. What I want to do is to have a date picker that shows nothing or a placeholder like input controls.

At the moment, I get an error when the value is null so I use moment(). The concern however is that it is not possible to know whether the value is actually set or not since the picker always displays something.

Fields like dateOfBirth and dateJoined appear to have values when the value is actually null.

Not really sure but in the current version, passing null as date does not throw exceptions so this issue is fixed.

Was this page helpful?
0 / 5 - 0 ratings