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?

3

1 Answer 1

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,
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.