Hi,
I have 2 dates after selecting of 1st date by default 2nd date display next year date
This is what i have tried my end
Could you please help me
function DisplayPolicyEndDate() {
var result = $("#Psd").val();
//change number according to your convience
var toDate = new Date(result.setFullYear(result.getFullYear() + 1));
toDate = new Date(toDate.setDate(toDate.getDate() - 1));
toDate = (toDate.getMonth() + 1) + "/" + toDate.getDate() + "/" + toDate.getFullYear();
alert(toDate);
}
@Html.TextBoxFor(a => a.Psd, new { @class = "form-control", @id = "Psd", @onchange = "DisplayPolicyEndDate()" })
@Html.TextBoxFor(a => a.PolicyEndDate, new { @class = "form-control", @id = "dtpolicyenddate" })
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
<!-- Bootstrap DatePicker -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.4/css/bootstrap-datepicker.css" type="text/css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.4/js/bootstrap-datepicker.js" type="text/javascript"></script>
$(document).ready(function () {
$('#Psd').datepicker({
changeMonth: true,
changeYear: true,
format: "dd/mm/yyyy",
language: "tr",
//startDate: startDate,
// endDate: endDate,
//multidate: multiDate,
todayHighlight: todayHighlight
});
}