Last active
April 30, 2021 15:07
-
-
Save salsalabs/569dff5cab13cb67e782f40270e9dd24 to your computer and use it in GitHub Desktop.
Script to change credit card expiration dates so that they start from the current year. This can be useful on Salsa storefronts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- BEGIN Change credit card expiration date year to start with the current year. --> | |
$(document).ready(() => { | |
const years = 20; | |
var e = $('select[name=ccExpYear]'); | |
if (e.length == 0) { | |
return; | |
} | |
$('option', e).remove(); | |
e.append('<option value="">Year</option>') | |
var thisYear = new Date().getFullYear(); | |
Array.from(Array(years).keys()).forEach((v) => { | |
var y = thisYear + v; | |
var t = `<option value="${y % 100}">${y}</option>` | |
e.append($(t)); | |
}); | |
}); | |
<!-- END Change credit card expiration date year to start with the current year. --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment