Jump to content

date picker and hide previous date


Nitesh kumar singh
 Share

Recommended Posts

<input type="date" id="datepicker">

<script>
        let DateToday=new Date();
        let month=DateToday.getMonth()+1;
        let day=DateToday.getDate();
        let year=DateToday.getFullYear();
        if(month<10)
            month='0'+month.toString();
        if(day<10)
            day='0'+day.toString();
        let Today=year+'-'+month+'-'+day;
        let maxdate=year+1+'-'+month+'-'+day;
        document.getElementById('datepicker').setAttribute("min",Today);
      </script>

Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...