[PM-10764] Fix ProtonPass creditCard expirationDate import (#10473)

* Fix ProtonPass creditCard expirationDate import with protonpass-json-importer.ts

* Update protonpass CC expirationDate testData to newest version

Between 1.3.1 and 1.12.2 ProtonPass has changed the format of exported CC expiration dates from MMYYYY to YYYY-MM

---------

Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
This commit is contained in:
Yann Plougonven--Lastennet 2024-08-12 20:45:32 +02:00 committed by GitHub
parent 6bc0ffc930
commit d5cc2d6518
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -102,7 +102,7 @@ export const testData: ProtonPassJsonFile = {
cardType: 0,
number: "1234222233334444",
verificationNumber: "333",
expirationDate: "012025",
expirationDate: "2025-01",
pin: "1234",
},
},

View File

@ -84,9 +84,9 @@ export class ProtonPassJsonImporter extends BaseImporter implements Importer {
cipher.card.code = this.getValueOrDefault(creditCardContent.verificationNumber);
if (!this.isNullOrWhitespace(creditCardContent.expirationDate)) {
cipher.card.expMonth = creditCardContent.expirationDate.substring(0, 2);
cipher.card.expMonth = creditCardContent.expirationDate.substring(5, 7);
cipher.card.expMonth = cipher.card.expMonth.replace(/^0+/, "");
cipher.card.expYear = creditCardContent.expirationDate.substring(2, 6);
cipher.card.expYear = creditCardContent.expirationDate.substring(0, 4);
}
if (!this.isNullOrWhitespace(creditCardContent.pin)) {