Skip to main content

Search and Top Navigation

#9688 closed bug (notabug)

Opened December 04, 2013 06:18PM UTC

Closed December 11, 2013 08:08PM UTC

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:
Description

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 http://plnkr.co/edit/DhikhK5DiaIswbreBKix

Attachments (0)
Change History (2)

Changed December 09, 2013 02:50PM UTC by tj.vantoll comment:1

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 - http://jsfiddle.net/tj_vantoll/wLe4b/.

In jQuery UI we are already inconsistent because spinner triggers a

change
event and the slider does not - http://jsfiddle.net/tj_vantoll/zZVfG/.

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.

Changed December 11, 2013 08:08PM UTC by tj.vantoll comment:2

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.