I am attemtping to do validation via HTML5 pattern and regex. I want to only accept dates in the YYYY-MM-DD format. I tried to find one, and I found this: ([12]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01]))
. However, when I test it, it accepts an empty input.
Could someone help me fix this please?
Thanks.