action.find('[data-date-to-for]').datepicker(options);
inputTo.val(selectedTo);
- // if the radio button is checked and one or both of the datepickers are
- // empty, populate them with today's date
- radio.change(function () {
- var now = new Date();
-
- if (inputFrom.val() === '') {
- inputFrom.datepicker('setDate', now);
- }
-
- if (inputTo.val() === '') {
- inputTo.datepicker('setDate', now);
- }
- });
-
// set filter_value based on date pickers when
// one of their values changes
var changeHandler = function () {
inputFrom.datepicker('option', 'maxDate', inputTo.val());
});
+ // if the radio button is checked and one or both of the datepickers are
+ // empty, populate them with today's date
+ radio.change(function () {
+ var now = new Date();
+
+ if (inputFrom.val() === '') {
+ inputFrom.datepicker('setDate', now);
+ }
+
+ if (inputTo.val() === '') {
+ inputTo.datepicker('setDate', now);
+ }
+
+ // setting the date like this doesn't fire the changeHandler to
+ // update the filter_value, so do that manually instead
+ changeHandler()
+ });
+
return action;
}