Keith-Wood DatePicker onSelect not working when rangeselect is true

Keith-Wood DatePicker onSelect not working when rangeselect is true

I'm using Keith-Wood DatePicker Plugin and adding below code in my project

  1. $('#ArrivalDate').datepick({
  2.       changeMonth: false,
  3.       dateFormat: 'dd M yyyy',
  4.       selectOtherMonths: true,
  5.       showAnim: false,
  6.       showOtherMonths: true,
  7.       monthsToShow: 2,
  8.       minDate: 0,
  9.       maxDate: '2Y-1',
  10.       rangeSelect: true,
  11.       onSelect: function (dates) {
  12.             alert('working');
  13.             var date1 = $.datepick.formatDate('dd M yyyy', dates[0]);
  14.             var date2 = $.datepick.formatDate('dd M yyyy', dates[1]);

  15.              $("#ArrivalDate.datepicker").val(date1);
  16.              $("#DepartureDate.datepicker").val(date2);
  17.        },
  18. });

Currently, facing following issues. 1) when I select first date it shows min & Max dates in ArrivalDate Text box, however, onClose it working fine. 2) Alert is not firing as onSelect is not working.

Exact requirement. if onSelect starts working then I want to compare first and second dates.

Thanks you in advance.