Kenlymar Paredes
Kenlymar Paredes

Reputation: 31

problems with the jquery datepicker

I have an input date where I want the user not to choose dates before the current day I am using the minDate function but by default, the calendar jumps me to the date of november 2027. I hope you can help me, I've been working on this for days.

$(document).ready(function(){ 
    $(function(){
        const fechaAhora= new Date();
        const year=fechaAhora.getFullYear();
        const mes=fechaAhora.getMonth() + 1;
        const dia=fechaAhora.getDate()+ 1;
        const fechaD=year+'-'+mes+'-'+dia;
        $("#fecha").datepicker({
            minDate:fechaD,
        })      
    })
});

enter image description here

Upvotes: 0

Views: 52

Answers (1)

Arif Khan
Arif Khan

Reputation: 508

Use this code:

minDate: new Date()

Upvotes: 1

Related Questions