OMikkel / tailwind-datepicker-react

A tailwindcss/flowbite datepicker component built as a react component with types
https://omikkel.github.io/tailwind-datepicker-react/
MIT License
160 stars 68 forks source link

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

Open sharucodes opened 1 year ago

sharucodes commented 1 year ago

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.

OMikkel commented 1 year ago

You can use the defaultDate property :)

sharucodes commented 1 year ago

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

OMikkel commented 1 year ago

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

sharucodes commented 1 year ago

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

Mpak17 commented 1 year ago

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'.

serabariq commented 7 months ago

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

filipkowal commented 4 months ago

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.