My screen as follows From Date Datepicker when i select the date less than the today date shows the message and date format of datepicker date dd-mm-yyyy. for that i written a code
$(function () {
$("#datepicker").datepicker();
$("#datepicker").on('change', function () {
var date = Date.parse($(this).val());
if (date < Date.now()) {
alert('Selected date must be greater than today date');
$(this).val('');
}
});
});
Date picker date format code as follows
$(function () {
$("#datepicker").datepicker({ dateFormat: "dd-mm-yy" }).val()
});
in run mode when i select the date less than today date means message shows correctly Selected date must be greater than today date. but date format is not changing , date format i get as 02/14/2018. the date format must 14-02-2018.
and selected date less than the today's date means message not showing Selected date must be greater than today date.
what is the mistake in my above code.