aAshrafZamanPlace
aAshrafZamanPlace

Reputation: 1

input date must be not be greater than current date in bootstrap datepicker [dd-M-yyyy] format

my input textbox

<input  type="text" id="dateOfDiagnosisTextbox" class="form-control" />

This is my jquery

$('#dateOfDiagnosisTextbox').datepicker({
            format: "dd-M-yyyy",
            autoclose: true,
            todayHighlight: true
        });

Date of textbox should be a valid date format (dd-M-yyyy) and must be not be greater than current date otherwise system should display appropriate error message.

Upvotes: 0

Views: 3865

Answers (2)

user5217795
user5217795

Reputation:

$('#dateOfDiagnosisTextbox').datepicker({
     format: "dd-M-yyyy",
     autoclose: true,
     todayHighlight: true,
     endDate: new Date()
});

Upvotes: 0

Shiladitya
Shiladitya

Reputation: 12181

Here you go with jsfiddle https://jsfiddle.net/or3jabbv/

 $( function() {
    $( "#datepicker" ).datepicker({ maxDate: "now" });
 } );

Upvotes: 1

Related Questions