Check if date is in the past Javascript

前端 未结 4 556
一整个雨季
一整个雨季 2020-12-01 03:58

All, I\'m using the jQuery UI for the date picker. I\'m trying to check with javascript though that the date the user has entered is in the past. Here is my form code:

4条回答
  •  孤城傲影
    2020-12-01 04:47

    var datep = $('#datepicker').val();
    
    if(Date.parse(datep)-Date.parse(new Date())<0)
    {
       // do something
    }
    

提交回复
热议问题