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

With a user dateFormat, the Auto-Select Range does not work

Open Wikinaut opened this issue 10 years ago • 2 comments

I use dateFormat: "dd.mm.yy", but then the Auto-Select Range does not work.

This does not work (autoselect range with a userdefined dateFormat):

function addDays(date, days) {
  var result = new Date(date);
  result.setDate(date.getDate() + days);
  return result;
}

var today = new Date();
var isoDate = today.toISOString().slice(0,10).replace(/-/g,"");
var y = today.getFullYear();
$('#calendar').multiDatesPicker({
    addDates: ['14.10.'+y, '19.02.'+y, '14.10.'+y, '16.11.'+y],
    numberOfMonths: [5,3],
    defaultDate: addDays(today,-90),
        dateFormat: "dd.mm.yy",
    beforeShowDay: $.datepicker.noWeekends,
    altField: '#altField',
    mode: 'daysRange',
    autoselectRange: [0,5]
});

This works (single-day selection and userdefined dateFormat):

function addDays(date, days) {
  var result = new Date(date);
  result.setDate(date.getDate() + days);
  return result;
}

var today = new Date();
var isoDate = today.toISOString().slice(0,10).replace(/-/g,"");
var y = today.getFullYear();
$('#calendar').multiDatesPicker({
    addDates: ['14.10.'+y, '19.02.'+y, '14.10.'+y, '16.11.'+y],
    numberOfMonths: [5,3],
    defaultDate: addDays(today,-90),
    dateFormat: "dd.mm.yy",
    beforeShowDay: $.datepicker.noWeekends,
    altField: '#altField'
});

Wikinaut avatar Oct 19 '15 08:10 Wikinaut

I have the same issue here...

thebmg avatar Jun 20 '16 10:06 thebmg

Please Help me. I have same problem !

mkens avatar Jul 11 '16 12:07 mkens