Opened 3 years ago

Closed 3 years ago

#9688 closed bug (notabug)

No event when date is changed by restrictMinMax

Reported by: nash Owned by:
Priority: minor Milestone: none
Component: ui.datepicker Version: 1.10.0
Keywords: Cc:
Blocked by: Blocking:


When integrating with frameworks such as angular.js, one can subscribe to onSelect event. However, if a date was changed by applying new min/maxDate, there's no way to detect this, because onSelect isn't fired.

The main input and altField are updated as expected, although altField is not always an option.

I'm not sure about onSelect, maybe a special event like onChangeDate (to be compared to onChangeMonthYear) is needed.

Here's a simple demo to demonstrate the problem

Change History (2)

comment:1 Changed 3 years ago by tj.vantoll

I did some research here to help determine how to handle this.

For the native inputs - date, number, and range at least - when the min is changed, a change event is not fired, and the value itself is not changed -

In jQuery UI we are already inconsistent because spinner triggers a change event and the slider does not -

Of course, a change event is not a select event, but the same idea applies.

I really don't think we should trigger an event here. And to take things a step further, we should probably avoid changing the value when the min/max is changed for consistency with the native controls.

comment:2 Changed 3 years ago by tj.vantoll

Resolution: notabug
Status: newclosed

We discussed this at our meeting. For consistency with the native control, we should avoid triggering an event, as well as stop changing the <input>'s value. We won't tackle this in the current datepicker, but I made a note for the rewrite.

Note: See TracTickets for help on using tickets.