Converts a 2-digit year to a 4-digit year for credit card expiration dates
Uses smart century detection: if the year is less than the current year's last two digits,
assumes next century to handle expired cards correctly
Parameters
twoDigitYear: string
The 2-digit year string (e.g., "25")
Returns string
The 4-digit year string (e.g., "2025")
Example
// In 2025: convertCreditCardYearToFourDigit("25"); // "2025" (current year) convertCreditCardYearToFourDigit("30"); // "2030" (future, same century) convertCreditCardYearToFourDigit("24"); // "2124" (past year, so next century)
Converts a 2-digit year to a 4-digit year for credit card expiration dates Uses smart century detection: if the year is less than the current year's last two digits, assumes next century to handle expired cards correctly