Currently using the below code which works well to parse my swiped data. However I need to show the month and year (as example) as January 2019 in separate fields. Right now it does it as 01 19. Anyway to edit this code?
function setFromCCS(ccs) {
var index1 = ccs.indexOf("%B") + 2;
var index2 = ccs.indexOf("^") + 1;
var index3 = ccs.indexOf("^", index2 + 1) + 1;
var cardNumber = ccs.substring( index1, index2 - 1);
var expMonth = ccs.substr(index3, 2);
var expYear = ccs.substr(index3 + 2, 2);
var holderName = ccs.substring(index2, index3 - 1);
$("#cn").val(cardNumber);
$("#em").val(expMonth);
$("#ey").val(expYear);
$("#hn").val(holderName);
}
Card number: <input type="text" name="ccnum" id="cn"><br />
Card exp month: <input type="text" name="ccnum" id="em"><br />
Card exp year: <input type="text" name="ccnum" id="ey"><br />
Card holder name: <input type="text" name="ccnum" id="hn"><br />