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

Fix for issue #1287 in bitwarden/web (#569)

* Format the fieldvalue as a LocaleDateString instead of epoch when importing a date from 1P

This would be better solved by storing it as a date FieldType instead of Text. But since it is unclear when new field types are added, this solution serves as a fix for now and also guides the solution when new fieldtype exists.

* Remove trailing whitespace

* Add tests for custom fields of 1pif imported identity

* Change representation of 1pif imported dates to UTC string

* Changes after running prettier

Co-authored-by: Daniel James Smith <djsmith@web.de>
This commit is contained in:
Linus Aarnio
2021-12-16 18:46:33 +01:00
committed by GitHub
parent e9666458c4
commit a8168d6ee7
2 changed files with 18 additions and 1 deletions

View File

@@ -172,7 +172,11 @@ export class OnePassword1PifImporter extends BaseImporter implements Importer {
return;
}
const fieldValue = field[valueKey].toString();
// TODO: when date FieldType exists, store this as a date field type instead of formatted Text if k is 'date'
const fieldValue =
field.k === "date"
? new Date(field[valueKey] * 1000).toUTCString()
: field[valueKey].toString();
const fieldDesignation =
field[designationKey] != null ? field[designationKey].toString() : null;