longbill/jquery-date-range-picker

"minDays" doesn't work in two inputs mode

mcvova opened this issue · 3 comments

Hi, minDays don't work in two inputs mode. How to prevent to set the same start and end date? I tryed minDays:0 and minDays:1, but it don`t work.

Demo link

HTML:

<span id="two-inputs"><input id="date-range200" size="20" value=""> to <input id="date-range201" size="20" value=""></span>

JS

$('#two-inputs').dateRangePicker({
  	minDays: 0,
		separator : ' to ',
		getValue: function()
		{
			if ($('#date-range200').val() && $('#date-range201').val() )
				return $('#date-range200').val() + ' to ' + $('#date-range201').val();
			else
				return '';
		},
		setValue: function(s,s1,s2)
		{
			$('#date-range200').val(s1);
			$('#date-range201').val(s2);
		}
});

same start and end day is considered 1 day.

So try setting minDays to 2, does that work?

@holtkamp is right - minDays needs to be set to 2.

See working example:

https://jsfiddle.net/jazcodes/43pzn2rj/1/

Since this issue is not a bug and the proper usage has already been demonstrated, I'm closing it. @mcvova, feel free to re-open the issue or open a new one if you consider this is still an issue or you have other questions.