Home > Software engineering >  problems with the jquery datepicker
problems with the jquery datepicker

Time:05-09

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

CodePudding user response:

Use this code:

minDate: new Date()
  • Related