I want to display default value of start_date and end_date field as yesterday and today respectively. Any help would be appreciated, thank you.
Here is my code:
$(document).ready(function () {
$('#start_date .input-group.date').datepicker({
startView: 1,
todayBtn: "linked",
keyboardNavigation: false,
forceParse: false,
autoclose: true,
format: 'yyyy-mm-dd'
default:today
});
$('#end_date .input-group.date').datepicker({
startView: 1,
todayBtn: "linked",
keyboardNavigation: false,
forceParse: false,
autoclose: true,
format: 'yyyy-mm-dd'
});
$('#published_date .input-group.date').datepicker({
startView: 1,
todayBtn: "linked",
keyboardNavigation: false,
forceParse: false,
autoclose: true,
format: 'yyyy-mm-dd'
});
});
My HTML:
<div class="col-md-2">
<div class="form-group" id="start_date">
<label for="">Start Date<span style="color: red;"> </span></label>
<div class="input-group date">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
<input type="text" class="form-control" required name="start_date">
</div>
</div>
</div>
<div class="col-md-2">
<div class="form-group" id="end_date">
<label for="">End Date<span style="color: red;"> </span></label>
<div class="input-group date">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
<input type="text" class="form-control" required name="end_date">
</div>
</div>
</div>