Multiple-Dates-Picker-for-jQuery-UI icon indicating copy to clipboard operation
Multiple-Dates-Picker-for-jQuery-UI copied to clipboard

call multiDatesPicker for multi times with defaultValue

Open pimkle opened this issue 9 years ago • 2 comments

If addDates and default were set together, and I call 'multiDatesPicker' for the second time, 2016-08-14 will be selected any way. Even if I called 'resetDates'. following is the sample code, run the script and you'll understand.

`

var date = new Date('2016-08-18');
  var date1 = date.setDate(19);
  var date2 = date.setDate(14);
  $('#simpliest-usage').multiDatesPicker({
    addDates: [date1, date2],
    defaultDate: date
  });

  setTimeout(function () { 
      $('#simpliest-usage').multiDatesPicker('resetDates');

      date = new Date();
      date1 = date.setDate(15);
      date2 = date.setDate(16);

    $('#simpliest-usage').multiDatesPicker({
      addDates: [date1, date2],
      defaultDate:date
    });
    $('#simpliest-usage').multiDatesPicker('removeDates', new Date('2016-08-14'));
  }, 5000);

`

pimkle avatar Sep 18 '16 03:09 pimkle

I'm currently calling removeDates to solve the issue temporarily lol. Glad that in my project, dates won't repeat.

pimkle avatar Sep 18 '16 03:09 pimkle

My problem is when i am loading MDP second time based on drop down, it is automatically selecting today date.

jQuery('#calender').multiDatesPicker();--------Showing calender jQuery('#calender').multiDatesPicker('resetDates');-----------------Not showing calender

take a look of my issue https://github.com/dubrox/Multiple-Dates-Picker-for-jQuery-UI/issues/190 what to do?

anandpandey0761 avatar Dec 31 '16 07:12 anandpandey0761