Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

83
Views
disable past dates from given date on datepicker

I am trying to have a date Range selected using the UI date picker.

in the from field people should not be able to view or select dates previous to the given day.

My Code:

<input type="text" class="form-control" name="from_date" id="f_date"
                       value="{{ Session::get('reviewerJoiningInfo.join_date') ? Session::get('reviewerJoiningInfo.join_date') : null }}"
                       placeholder="From Date" onkeydown="return false" autocomplete="off">

getting a date from the session

$('#f_date').datepicker({
                format: 'dd-mm-yyyy',
            }).on('changeDate', function (ev) {
                    var rev_join_date = $('#f_date').val()
                    var reviewer_join_date = $('#reviewer_join_date').val()
                    if(rev_join_date < reviewer_join_date){
                        $('#f_date').val(reviewer_join_date)
                    }
                    $(this).datepicker('hide');
                }
            );

I used minDate: date but not working.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

To disable past year date you can pass yearrange in parameters. like

yearRange: '1950:2013', // specifying a hard coded year range

or

   yearRange: "c-100:c+0", // last hundred years and current years

Example:

$(document).ready(function() {
    $("#date").datepicker({
        changeYear:true,
        yearRange: "2005:2015"
    });
});

previous 10 years and next 10 years:

 $('#datepicker2').datepicker({
     changeMonth: true,
     changeYear: true,
     minDate: 0,
     yearRange: 'c-10:c+20',

 }); 

if you want to disable past Date you can pass startDate or minDate

  $('#date').datepicker({
    changeMonth: true,
    changeYear: true,
    showButtonPanel: true,
     minDate: new Date(),
});

FIDDLE: For disabling past dates https://jsfiddle.net/p0deLk56/

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!