# No event for ion-datetime arrows makes highlightdates useless?

**URL:** <https://forum.ionicframework.com/t/no-event-for-ion-datetime-arrows-makes-highlightdates-useless/237743>\
**Category:** Ionic Framework\
**Created:** [November 16, 2023, 3:39am UTC](https://forum.ionicframework.com/t/no-event-for-ion-datetime-arrows-makes-highlightdates-useless/237743 "2023-11-16T03:39:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rtpHarry](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rtpharry/32/121938_2.png) [@rtpHarry](https://forum.ionicframework.com/u/rtpHarry)\
**Post date:** [November 16, 2023, 3:39am UTC](https://forum.ionicframework.com/t/no-event-for-ion-datetime-arrows-makes-highlightdates-useless/237743/1 "2023-11-16T03:39:58Z")

</div>

I wanted to implement highlighted dates on the ion-datetime but there doesn’t seem to be events for the arrows in the top right.

Am I missing something? I’ve tried binding (ionChange) and (ngModelChange) to try to capture it.

Events are triggered if you use the top left month/year selector, or click on a date, but nothing for the \< \> arrows in the top right.

Can’t find any documentation for it either. That means I would need to load in the entire history of the data set to use the highlighted dates functionality?

Looking at the source code I can’t find any hints of what may be triggered, the closest I could find is the handler for the next button, which doesn’t seem to fire any events:

> <https://github.com/ionic-team/ionic-framework/blob/f143bd0a11941739ee616908891509b48bd48463/core/src/components/datetime/datetime.tsx#L1376>

Although I acknowledge this might not be the full picture, as I don’t know if calendar.scrollTo may trigger things. I was trying to use GitHub to track this down but scrollTo seemed to be a dead end in its browsing.

I did find reference to it only loading the calendar for 3 months (last current next) but not what event it might load more from.

Can anyone either point me in the right direction, or confirm that this

---

<div class="post-metadata">

**Author:** ![XiaoMing001](https://avatars.discourse-cdn.com/v4/letter/x/278dde/32.png) [@XiaoMing001](https://forum.ionicframework.com/u/XiaoMing001)\
**Post date:** [December 4, 2023, 3:06am UTC](https://forum.ionicframework.com/t/no-event-for-ion-datetime-arrows-makes-highlightdates-useless/237743/2 "2023-12-04T03:06:41Z")

</div>

Hi, I encountered similar problem. I tried to deal with it like this:

```auto
  useIonViewDidEnter(() => {
    const calendarHeader = document
      .querySelector('ion-datetime')
      ?.shadowRoot?.querySelector('.calendar-next-prev')
      ?.querySelectorAll('ion-button');
    if (calendarHeader && calendarHeader.length > 1) {
      calendarHeader[0].addEventListener('click', prevMonthDate);
      calendarHeader[1].addEventListener('click', nextMonthDate);
    }
  });

  const prevMonthDate = useCallback(() => {
    setSelectDateValue((prevDate) => prevDate.minus({ months: 1 }));
  }, []);

  const nextMonthDate = useCallback(() => {
    setSelectDateValue((prevDate) => {
      const date = prevDate.plus({ months: 1 });
      return date.millisecond > currentDate.millisecond ? currentDate : date;
    });
  }, [currentDate]);

```
