The Jquery Datepicker to select a date range

Maybe someone in the project were faced with the same task. Need a calendar with selectable date range from and to, ie the person clicks 1 time on the first date is the start date of the event clicks in the same calendar a second time — this is the end of the event, and all dates between start and end are highlighted.

Not found any solution to the jQuery UI Datepicker though perhaps badly searched. Possible solutions ready and not, but to spell it is elementary and someone has already implemented this, maybe share information or algorithm?

Thanks in advance!
October 8th 19 at 03:54
3 answers
October 8th 19 at 03:56
jQuery UI Datepicker involves storing in the input date value, so to select a range using two input fields.
October 8th 19 at 03:58
Jquery Datepicker:
Two fields are input type="text" id="from" id="to"
Handling code
$(function() {<br> var dates = $( "#from, #to" ).datepicker({<br> onSelect: function( selectedDate ) {<br> var option = == "from" ? "minDate" : "maxDate",<br> instance = $( this ).data( "datepicker") <br> date = $.datepicker.parseDate(<br> instance.settings.dateFormat ||<br> $.datepicker._defaults.dateFormat<br> selectedDate, instance.settings );<br> dates.not( this ).datepicker( "option", option, date );<br> }<br> });<br> });
Click inside the field called calendar, if one of the fields already selected in the calendar prohibited the selection of "before" or "after" is selected, depending on what was selected first.
Thanks, but not quite ) had in mind here such as here select the start and end of the flight. - brenna commented on October 8th 19 at 04:01
The solution is still not found? now ask the same question, is there an inline calendar and need to make a choice from and to insert dates in certain fields, from 1 field figured out, but when 2, how to use, how to highlight, problem. - Hershel.Schroeder commented on October 8th 19 at 04:04
you need to write something of their own ( - brenna commented on October 8th 19 at 04:07
October 8th 19 at 04:00

Find more questions by tags jQueryCalendar