Bootstrap DatePicker is resetting to default date after page reload. If I don't reload the page I'm able to keep selected date
<div class="form-group">
<label>Action Date </label>
<div class='input-group date' id='dpServiceDate'>
<input type='text' class="form-control" id="actionDate" name="actionDate" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
$(document).ready(function() {
$('#dpServiceDate').datetimepicker({
defaultDate: "@Model.ActionDate.Date.ToString("MM-dd-yyyy")",
format: 'MM-DD-YYYY',
maxDate: moment().subtract(1, 'days')
}).on('dp.change', function(e) {
location.href = "/XYZ/DashBoard/Index?Id=" + @Model.ClientId + "&ActionDate=" + $("#actionDate").val();
})
});