Vince Osana
Vince Osana

Reputation: 417

Limit date range selection on Datepicker

I copied a datepicker bootstrap online but I want to set a limit on how many days the user can select in the calendar, like you can only select maximum of 7 days ie: Jan 1, 2016 - Jan 7, 2016 = OK Jan 12, 2016 - Jan 15, 2016 = OK Jan 19, 2016 - Jan 29, 2016 = ERROR

Upvotes: 0

Views: 2729

Answers (2)

Ehsan Abidi
Ehsan Abidi

Reputation: 959

If you are using jQuery UI DatePicker, It has a minDate property you can set to suppress the user from selecting older than that day.

Upvotes: 0

Sandeep sidhu
Sandeep sidhu

Reputation: 67

.. here is bootstrap datepicker available which can solve your issue. You can refer this link: http://www.daterangepicker.com/ or use this in your script:

<input type="text" name="daterange" value="01/01/2015 1:30 PM - 01/01/2015 2:00 PM" /> 
<script type="text/javascript">
$(function() {
    $('input[name="daterange"]').daterangepicker({
        timePicker: true,
        timePickerIncrement: 30,
        locale: {
            format: 'MM/DD/YYYY h:mm A'
        }
    });
});
</script>

Hope it helps you!

Upvotes: 1

Related Questions