Open Bilge opened 5 months ago
It doesn't seem to me that to scroll years is a preference common to many. Some may want to scroll months, others may want to move the focused date. Some may want it to work only when a modifier key is pressed, others may think it's totally unnecessary. So, I think it's better to be done by the user on their app.
You should be able to do it by something like this:
const elem = document.querySelector('.date');
const dp = new Datepicker(elem);
elem.addEventListener('wheel', (ev) => {
const date = dp.getFocusedDate();
const year = date.getFullYear() + (ev.deltaY > 0 ? 1 : -1);
dp.setFocusedDate(date.setFullYear(year));
ev.preventDefault();
});
Hi, I would use this library if it had mouse-wheel support for scrolling years.