Validate two dates of this “dd-MMM-yyyy” format in javascript

前端 未结 5 1453
时光取名叫无心
时光取名叫无心 2020-12-21 08:33

I have two dates 18-Aug-2010 and 19-Aug-2010 of this format. How to find whether which date is greater?

5条回答
  •  南方客
    南方客 (楼主)
    2020-12-21 08:57

    You can do the parsing manually, for your given format, but I'd suggest you use the date.js library to parse the dates to Date objects and then compare. Check it out, its awesome!

    And moreover, its a great addition to your js utility toolbox.

提交回复
热议问题