tailwind-datepicker-react icon indicating copy to clipboard operation
tailwind-datepicker-react copied to clipboard

Query: How to keep date field empty on component mount.

Open sharucodes opened this issue 1 year ago • 7 comments

By default when component is mounted the current date is selected. Is there a way to keep the field empty similar to what clear button does.

sharucodes avatar Jul 01 '23 08:07 sharucodes

You can use the defaultDate property :)

OMikkel avatar Jul 01 '23 18:07 OMikkel

When i set the deafultDate property to false it shows current date when the component is mounted.

sharucodes avatar Jul 01 '23 18:07 sharucodes

Try to set it as null it should be either Date | null

OMikkel avatar Jul 01 '23 18:07 OMikkel

image image I still get todays date when the component is mounted.

I want it to be like below. That's when I press clear. image

sharucodes avatar Jul 01 '23 19:07 sharucodes

image image I still get todays date when the component is mounted.

I want it to be like below. That's when I press clear. image

It works, but another error occurs: Types of property 'defaultDate' are incompatible. Type 'null' is not assignable to type 'Date | undefined'.

Mpak17 avatar Sep 18 '23 07:09 Mpak17

It's not working on me either. I'd already set defaultDate to null | undefined | '' but it still have value on previous selected date. I think this plugin cant programatically clear value

serabariq avatar Apr 24 '24 06:04 serabariq

It works for me in version 1.4.3 when null is provided. The readme is misleading as it wrongly suggest using false and should be corrected.

filipkowal avatar Jul 11 '24 13:07 filipkowal