I'm wish to set the date value into the datetimepicker using jQuery based on the value got from the datetimepicker (datetimepicker1) and duration (input_duration) in days. Any idea how to do it? Here are my code:
HTML
<label for="label_duration" class="col-sm-2 control-label">Duration</label>
<div class="col-sm-2">
<input type="text" class="form-control" id="input_duration" name="input_duration" placeholder="Days" required/>
</div>
<div class="col-sm-4">
<label for="label_duration" id="lblStartDate" class="col-sm-2 control-label">Start Date</label>
<div class='input-group date' id='datetimepicker1'>
<input type='text' class="form-control" name="startdate" id="startdate" placeholder="yyyy-mm-dd" required/>
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
<div class="col-sm-4">
<label for="label_duration" id="lblEndDate" class="col-sm-2 control-label">End Date</label>
<div class='input-group date' id='datetimepicker2'>
<input type='text' class="form-control" name="enddate" id="enddate" placeholder="yyyy-mm-dd" required/>
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
jQuery
$(function () {
$('#datetimepicker1').datetimepicker({
viewMode: 'years',
format: 'YYYY-MM-DD'
});
$('#datetimepicker2').datetimepicker({
viewMode: 'years',
format: 'YYYY-MM-DD'
});
});
This will change up the date modal and update your date time picker widget