I want a Regular Expression for validation Persian date like 1396/4/3
, 1396/12/08
or something else.
in other words, I want to ensure that format of Persian Date (as String
) is some thing like these valid formats are:
1.YYYY/MM/DD
2.YYYY/MM/D
3.YYYY/M/DD
4.YYYY/M/D
any Solution?
use this Regex :
/^[1-4]\d{3}\/((0[1-6]\/((3[0-1])|([1-2][0-9])|(0[1-9])))|((1[0-2]|(0[7-9]))\/(30|([1-2][0-9])|(0[1-9]))))$/
this regex in jquery full check your persian date template
Year : 4 digits starts with 1300 or 1400
Month,Day : for the 6 first months of a year calculate 31 days and for the 5 next months of a year calculate 30 days and for last month of a year calculate 29 days