diff --git a/packages/browser-wallet-api/src/util.ts b/packages/browser-wallet-api/src/util.ts index a8555728..eddc629c 100644 --- a/packages/browser-wallet-api/src/util.ts +++ b/packages/browser-wallet-api/src/util.ts @@ -32,6 +32,9 @@ function replacer(this: any, k: string, value: any) { } const rawValue = this[k]; if (rawValue instanceof Date) { + if (Number.isNaN(rawValue.getTime())) { + throw new Error(`Received a Date instance that was an invalid Date. Raw value was: [${rawValue}]`); + } return { '@type': serializationTypes.Date, value }; } if (Buffer.isBuffer(rawValue)) { diff --git a/packages/browser-wallet/CHANGELOG.md b/packages/browser-wallet/CHANGELOG.md index e11e9e65..c1dfb64d 100644 --- a/packages/browser-wallet/CHANGELOG.md +++ b/packages/browser-wallet/CHANGELOG.md @@ -9,6 +9,7 @@ ### Fixed - An issue where changing the credential metadata URL to an invalid URL, or a URL that does not contain a credential metadata file, would result in an empty screen. +- An issue where an invalid Date would result in the epoch timestamp instead of returning an error. - Enabled ID statement checks for Web3 ID proof requests containing account credential statements. ## 1.1.3