Skip to content
This repository has been archived by the owner on Oct 20, 2022. It is now read-only.

Commit

Permalink
Merge pull request #2 from kyto-gmbh/from-and-to-highlighted-at-same-…
Browse files Browse the repository at this point in the history
…time

don't higligcht both inputs when manually change 'to' date
  • Loading branch information
piotrk-dev authored Mar 16, 2018
2 parents e2ad3f4 + c9b41ac commit 41a80e3
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions daterangepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,8 @@
return false;
},

updateView: function() {
updateView: function(options) {

if (this.timePicker) {
this.renderTimePicker('left');
this.renderTimePicker('right');
Expand All @@ -549,16 +550,23 @@
this.container.find('.right .calendar-time select').removeAttr('disabled').removeClass('disabled');
}
}

this.updateMonthsInView();
this.updateCalendars();
this.updateFormInputs();

if (options && options.actionType === 'keyup') {
return;
}

if (this.endDate) {
this.container.find('input[name="daterangepicker_end"]').removeClass('active');
this.container.find('input[name="daterangepicker_start"]').addClass('active');
this.container.find('input[name="daterangepicker_end"]').removeClass('active');
} else {
this.container.find('input[name="daterangepicker_end"]').addClass('active');
this.container.find('input[name="daterangepicker_start"]').removeClass('active');
this.container.find('input[name="daterangepicker_end"]').addClass('active');
}
this.updateMonthsInView();
this.updateCalendars();
this.updateFormInputs();

},

updateMonthsInView: function() {
Expand Down Expand Up @@ -1607,12 +1615,13 @@
this.setStartDate(date);
}

this.updateView();
this.updateView({ actionType: 'keyup' });
}

},

formInputsKeydown: function(event) {

// This function ensures that if the 'enter' key was pressed in the input, then the calendars
// are updated with the startDate and endDate.
// This behaviour is automatic in Chrome/Firefox/Edge but not in IE 11 hence why this exists.
Expand Down

0 comments on commit 41a80e3

Please sign in to comment.