How to check if input date is equal to today's date?

后端 未结 10 1107
忘了有多久
忘了有多久 2020-11-28 05:13

I have a form input with an id of \'date_trans\'. The format for that date input (which is validated server side) can be any of:

  • dd/mm/yyyy
  • dd-mm-yyyy
10条回答
  •  时光取名叫无心
    2020-11-28 05:43

    There is a simpler solution

    if (inputDate.getDate() === todayDate.getDate()) {
       // do stuff
    }
    

    like that you don't loose the time attached to inputDate if any

提交回复
热议问题