1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-18 09:13:33 +00:00

fix lastpass importer tests

This commit is contained in:
Kyle Spearrin
2020-02-06 15:28:17 -05:00
parent 3c6f6dbe2f
commit 76f60dd99e
2 changed files with 92 additions and 49 deletions

View File

@@ -177,19 +177,19 @@ export class LastPassCsvImporter extends BaseImporter implements Importer {
if (this.isNullOrWhitespace(mappedData.expMonth) || mappedData.expMonth === ',') {
// No expiration data
mappedData.expMonth = null;
mappedData.expMonth = undefined;
} else {
const [monthString, year] = mappedData.expMonth.split(',');
// Parse month name into number
if (!this.isNullOrWhitespace(monthString)) {
const month = new Date(Date.parse(monthString.trim() + ' 1, 2012')).getMonth() + 1;
if (isNaN(month)) {
mappedData.expMonth = null;
mappedData.expMonth = undefined;
} else {
mappedData.expMonth = month.toString();
}
} else {
mappedData.expMonth = null;
mappedData.expMonth = undefined;
}
if (!this.isNullOrWhitespace(year)) {
mappedData.expYear = year;