Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw error in replacer if date is invalid #371

Merged
merged 2 commits into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/browser-wallet-api/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
1 change: 1 addition & 0 deletions packages/browser-wallet/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,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.

## 1.1.3

Expand Down
Loading