I have a credit card entry form on a site I help maintain. The back end is coded to take a 2 digit expiration month and 2 digit year in the format MM/YY. Chrome seems to be set on applying credit card information in the format MM/YYYY, and so if the user has a stored CC with expiration 05/2023 it will autofill with 05/20 and due to jquery input masking will cut off the 23 portion. This results in a declined payment, which no body wants.
Here's the basic example of the form.
<form action="/">
<h3>Label</h3>
<div>
<input name="CardHolderName" placeholder="Cardholder Name" type="text">
</div>
<div>
<input name="CreditCardNumber" placeholder="Credit Card Number" type="tel">
</div>
<div>
<label for="ExpirationDate">Expirion Date</label>
<input id="ExpirationDate" name="ExpirationDate" placeholder="MM/YY" type="tel">
</div>
<div>
<input name="Cvv2" placeholder="CVC" type="tel">
</div>
</form>
I have scanned https://wiki.whatwg.org/wiki/Autocomplete_Types and https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill and found autocomplete="cc-exp", and some guidance on format.
In the older spec, which is deprecated, the format somewhat matches what Chrome is doing, mentioning the MM/YYYY format when maxlength="7". In this case, maxlength="5" should give me what I want, but it's not consistent. For example, adding maxlength="5" works in my jsfiddle, but doesn't work on our web site. However, adding autocomplete="cc-exp" and maxlength="5" works on the web site with desktop Chrome, but not Chrome on Android it seems. Chrome on my Andrid phone still autofills with MM/YYYY.
The newer spec says the format is YYYY-MM, which doesn't match what Chrome is doing and thus is not helpful. There is no mention of any other accepted format.
This fiddle (https://jsfiddle.net/JonathanN/j054kbgx/) shows all the derivations of my original form, and all the results I have seen. It would be great if there were a 100% guaranteed way to tell the browser the format is MM/YY. Failing that, having more information on how these forms work for other people would be helpful too.