Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Calendar Icon Clickable #4091

Closed
sinklair opened this issue Jun 21, 2023 · 9 comments · Fixed by qburst/react-datepicker-3#9 or #4417
Closed

Make Calendar Icon Clickable #4091

sinklair opened this issue Jun 21, 2023 · 9 comments · Fixed by qburst/react-datepicker-3#9 or #4417

Comments

@sinklair
Copy link

When the calendar icon is displayed, clicking it does not display the calendar/time selectors. Most datetime pickers that display a calendar will display the calendar when the icon is clicked.

@nitink66
Copy link

The same issue is faced after updating the package to the latest version - 4.16.0.

@nitink66
Copy link

nitink66 commented Aug 14, 2023

Previous issue raised for the same Opening DatePicker Manually #685

@sinklair
Copy link
Author

@nitink66 I disagree on this being the same issue. If I follow that very long thread correctly, the issue there is opening the calendar programmatically. I am requesting that clicking the calendar icon have a built-in behavior to open the picker.

@AndersRemienHansen
Copy link

Was utterly surprised not being able to solve this out of the box. Any suggested options for handling this for now?

balajis-qb pushed a commit to qburst/react-datepicker-3 that referenced this issue Dec 18, 2023
Make the calendar icon clickable that helps to toggle the open status of the calendar.  Added new test cases to validate the new feature and updated the existing test case of checking the calendar icon class to make the new feature.

Closes Hacker0x01#4091
balajis-qb pushed a commit to qburst/react-datepicker-3 that referenced this issue Dec 18, 2023
Make the calendar icon clickable that helps to toggle the open status of the calendar.  Added new test cases to validate the new feature and updated the existing test case of checking the calendar icon class to make the new feature.

Closes Hacker0x01#4091
balajis-qb pushed a commit to qburst/react-datepicker-3 that referenced this issue Dec 18, 2023
…mponent

Attach the onClick listener on the custom calendar icon component without overriding it's existing onClick listener and call both the event handlers based on their existence

Closes Hacker0x01#4091
balajis-qb pushed a commit to qburst/react-datepicker-3 that referenced this issue Dec 18, 2023
…ggleCalendarOnIconClick

Set the onClick to the <CalendarIcon /> component only when toggleCalendarOnIconClick is set

Closes Hacker0x01#4091
martijnrusschen added a commit that referenced this issue Dec 19, 2023
…r-icon

Feature #4091 - Make the Calendar Icon clickable
@subhashreerautray
Copy link

subhashreerautray commented Jan 23, 2024

toggleCalendarOnIconClick props is not available on datepicker

open issue #4461

@balajis-qb
Copy link

balajis-qb commented Jan 23, 2024

Hi @subhashreerautray ,

The toggleCalendarOnIconClick is available on the react-datepicker. If you check our documentation https://reactdatepicker.com/#example-toggle-calendar-open-status-on-click-of-the-calendar-icon we documented how to use that feature.

The only problem is @types/react-datepicker repo is not updated with this change. If you are not using typescript or didn't install @types/react-datepicker in your TypeScript project you can able to use this feature even now. I already created a PR on that repo to fix that issue, I hope that'll be merged soon once someone reviews my change.

@balajis-qb
Copy link

@subhashreerautray, My PR to support the toggleCalendarOnIconClick prop got merged. It'll be available whenever they release the version DefinitelyTyped/DefinitelyTyped#68282

@PetracekSimon
Copy link

@balajis-qb

Hello, is there any way to use toggleCalendarOnIconClick prop with using custom icon?

@balajis-qb
Copy link

Use the open prop like the below example.

() => {
  const [date, setDate] = useState(new Date());
  const [open, setOpen] = useState(false);

  return (
    <DatePicker
      showIcon
      selected={date}
      open={open}
      onChange={(date) => setStartDate(date)}
      icon={
        <svg
          onClick={() => setOpen(!open)}
        >
          ...
        </svg>
      }
    />
  );
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants