From 1d03103faf67792fab06f59a1af7ab805ebd78bd Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 9 Oct 2019 17:12:21 -0400 Subject: [PATCH] support reversed 13 length month select --- src/services/autofill.service.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/services/autofill.service.ts b/src/services/autofill.service.ts index 6f05d7e022c..e1ab8b614be 100644 --- a/src/services/autofill.service.ts +++ b/src/services/autofill.service.ts @@ -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]; }