support reversed 13 length month select

This commit is contained in:
Kyle Spearrin 2019-10-09 17:12:21 -04:00
parent 3e1e05ab4f
commit 1d03103faf
1 changed files with 10 additions and 4 deletions

View File

@ -494,14 +494,20 @@ export default class AutofillService implements AutofillServiceInterface {
if (fillFields.expMonth.selectInfo && fillFields.expMonth.selectInfo.options) {
let index: number = null;
if (fillFields.expMonth.selectInfo.options.length === 12) {
const siOptions = fillFields.expMonth.selectInfo.options;
if (siOptions.length === 12) {
index = parseInt(card.expMonth, null) - 1;
} else if (fillFields.expMonth.selectInfo.options.length === 13) {
index = parseInt(card.expMonth, null);
} else if (siOptions.length === 13) {
if (siOptions[0][0] != null && siOptions[0][0] !== '' &&
(siOptions[12][0] == null || siOptions[12][0] === '')) {
index = parseInt(card.expMonth, null) - 1;
} else {
index = parseInt(card.expMonth, null);
}
}
if (index != null) {
const option = fillFields.expMonth.selectInfo.options[index];
const option = siOptions[index];
if (option.length > 1) {
expMonth = option[1];
}