How to check date with current date using jQuery

前端 未结 6 1319
长情又很酷
长情又很酷 2020-12-11 08:27

I want to check my date is greater than current date

$(\"#EndDate\").val() =\"5/13/2014\" ->M/d/y

Please find below code



        
6条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-11 09:09

    However, I am late to answer this, but here is my approach to solve this issue:

    var TodayDate = new Date();
    var endDate= new Date(Date.parse($("#EndDate").val()));
    
    if (endDate> TodayDate) {
        // throw error here..
    }
    

提交回复
热议问题