Date format in HTML form should be "mm/yy"
P粉990008428
2023-09-01 11:00:27
<p>I want to create an HTML page containing a form, where one cell should be a date in the format 'mm/yy', with the minimum value being the current month (similar to a credit card expiration date). </p>
<p>What should I do? I didn't find an option to use a date/month type, is there a better option than using text that matches a regex? </p>
<pre class="brush:php;toolbar:false;"><input type="text" pattern="\d{2}/\d{2}" required></pre> </p>
I recommend using the "date" type. It has a lot of features built into it. You can also set minimum and maximum values. You can find more information here: https://developer.mozilla.org/ru/docs/Web/HTML/Element/Input/date
Example: