0

i currently have a input type that accepts date. In the front end, i wanted that the user cannot chose dates that is before today. i already have a backend validation using laravel's after:date validation but i also wanted that in the front end, the user wont be able tp choose dates before the current date. In my form i have this code:

<div class="form-group">
    {{ Form::label('ddate', 'Expected Delivery Date') }}
    {{ Form::input('date', 'date', Input::old('date'), ['class'=>'datepicker', 'placeholder' => 'Date']) }}<span class="errmsg" style="color:red"><i>{{ $errors->first('date', ':message') }}</i></span>
  </div>

any ideas?

BourneShady
  • 955
  • 2
  • 17
  • 36

1 Answers1

5

Please check this solution click here for the code demo.

var dateobj = new Date(); //Get today's date
var yesterday = new Date(dateobj.getFullYear(), dateobj.getMonth(), dateobj.getDay() - 2);
$("#datepicker").datepicker({
    startDate: yesterday,
});
Sandeep J Patel
  • 910
  • 9
  • 24