Regular expression for date format- dd-mm-yyyy in Javascript

后端 未结 11 1792
南笙
南笙 2020-12-09 21:14

I need a regular expression for date format: dd-mm-yyyy in Javascript.

11条回答
  •  长情又很酷
    2020-12-09 21:32

    Notice

    Your regexp does not work for years that "are multiples of 4 and 100, but not of 400". Years that pass that test are not leap years. For example: 1900, 2100, 2200, 2300, 2500, etc. In other words, it puts all years with the format \d\d00 in the same class of leap years, which is incorrect. – MuchToLearn

    So it works properly only for [1901 - 2099] (Whew)

提交回复
热议问题