I’d like to disable the ion-datetime’s month/year picker, leaving the user to navigate months by using only the left and right arrows. There is no configuration option for this in the docs unfortunately, and that month/year element is in shadow dom. Does anyone know of a workaround to accomplish this?
Hello mate !
You access the show part of the component and do what you want to do.
Here is an exemple of disabling the ‘calendar-month-year’ mouse click.
disableMonthSelector() {
const ionDateTimeElement = document.getElementsByTagName(‘ion-datetime’);
const element = ionDateTimeElement[0].shadowRoot.getRootNode().firstChild as HTMLElement;
const monthsSelector = element.getElementsByClassName(
‘calendar-month-year’
)[0] as HTMLElement;
monthsSelector.style.pointerEvents = ‘none’;
}
Hope it helps !
Cheers
Hello
this works for android but not for ios, do you have an idea whats the reason for that?
Or do you have another solution that might work for android and ios?
Did you find a solution to this?