how can I compare dates in array to find the earliest one?

前端 未结 5 1672
故里飘歌
故里飘歌 2021-01-21 00:41

I have a variable called dateArray with dates in it for example

[\"09/09/2009\", \"16/07/2010\", \"29/01/2001\"]

and I want to find the earlies

5条回答
  •  时光取名叫无心
    2021-01-21 01:20

    The easiest way is to create dates object and the you can check grater/equal.. (date1 > date2)

    Example to create date: Convert dd-mm-yyyy string to date

提交回复
热议问题