I have two date inputs to let users choose a range of date for searching. However, I need to limit that the date range should not be longer than 7 days. For example, if user choose date from 12/9/2018, the date to should not be more than 19/9/2018. How could I achieve it ? Thank you.
My codes:
<div class="container">
<div class="col-sm-12">
<h1><span class="label label-danger">Report</span></h1><br><br>
<div class="pull-right">
<form class="form-inline" role="search" method = "post">
<div class="form-group">
<span class="label label-primary">Search and Sort</span>
<span class="label label-info">Date</span>
<input type="date" class="form-control" placeholder="Order Date From" name = "searchDateFrom" >
<input type="date" class="form-control" placeholder="Order Date To" name = "searchDateTo" >
</div>
<button class="btn btn-default " type="submit" name="submit" value = "search"><i class="glyphicon glyphicon-search"></i>
</form>
</div>
</div>
It can either prompting message to tell users to choose between the dates, or block the date from clicking. Please help, thanks.