1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-20 10:13:31 +00:00

[PM-11350] Use shared expiration year normalization util function (#10735)

* use shared expiration year normalization util function

* use shared exp year normalization in web and desktop client

* handle cases where input has leading zeroes

* add utils tests

* handle cases where input is all zeroes
This commit is contained in:
Jonathan Prusik
2024-09-03 15:12:36 -04:00
committed by GitHub
parent b27dc44298
commit 5f2eecd7be
8 changed files with 142 additions and 12 deletions

View File

@@ -11,6 +11,7 @@ import { FolderView } from "@bitwarden/common/vault/models/view/folder.view";
import { LoginUriView } from "@bitwarden/common/vault/models/view/login-uri.view";
import { LoginView } from "@bitwarden/common/vault/models/view/login.view";
import { SecureNoteView } from "@bitwarden/common/vault/models/view/secure-note.view";
import { normalizeExpiryYearFormat } from "@bitwarden/common/vault/utils";
import { ImportResult } from "../models/import-result";
@@ -263,7 +264,8 @@ export abstract class BaseImporter {
cipher.card.expMonth = expiryMatch.groups.month;
const year: string = expiryMatch.groups.year;
cipher.card.expYear = year.length === 2 ? "20" + year : year;
cipher.card.expYear = normalizeExpiryYearFormat(year);
return true;
}