- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Credit Card Expiration Date Error
I have a rare problem on a live system in some code from an outside developer I hired. The error message comes back as "Please provide valid expiration year." The expiration date was entered as "10/22". Here is how it is being formatted. It is being sent with JSON. What format is expected?
function evaluateFormFields()...
expirationDate = $.trim($("#txtExpirationDate").val()).replace(" / ", "");
function sendCCDataToAnet()...
var ccExpireMonth = expirationDate.substr(0,2);
var ccExpireYear = expirationDate.substr(2,2);
โ02-03-2023 10:55 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It appears that the code is presuming that the entered expiration date is in the form "MM/YY". The code is only attempting to extract the last two digits of the provided number as the year, despite the error notice indicating that a proper expiration year is expected.
The format used to insert credit card expiration dates is commonly "MM/YYYY," where "MM" stands for "month" and "YYYY" stands for "year." To handle this format and extract the relevant numbers for the month and year, the code needs to be modified.
โ02-13-2023 01:03 AM

