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

后端 未结 10 1112
忘了有多久
忘了有多久 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:27

    Try using moment.js

    moment('dd/mm/yyyy').isSame(Date.now(), 'day');
    

    You can replace 'day' string with 'year, month, minute' if you want.

提交回复
热议问题