From bf77395ffd62d3207c866e5a1cbc5b30f7776cec Mon Sep 17 00:00:00 2001 From: Hjort Date: Fri, 1 Sep 2023 13:15:07 +0200 Subject: [PATCH] Fix addMinimumAge --- packages/common/CHANGELOG.md | 1 + packages/common/src/idProofs.ts | 2 +- packages/common/src/web3Proofs.ts | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/common/CHANGELOG.md b/packages/common/CHANGELOG.md index 170366b06..582429bd4 100644 --- a/packages/common/CHANGELOG.md +++ b/packages/common/CHANGELOG.md @@ -11,6 +11,7 @@ ### Fixed - Aligned credential schema types with the tested types in the browser wallet. +- `addMinimumAge` now creates the precise age statement instead of one day off. ## 9.1.1 diff --git a/packages/common/src/idProofs.ts b/packages/common/src/idProofs.ts index 8c2201a8e..60678ea09 100644 --- a/packages/common/src/idProofs.ts +++ b/packages/common/src/idProofs.ts @@ -352,7 +352,7 @@ export class IdStatementBuilder implements StatementBuilder { * @returns the updated builder */ addMinimumAge(age: number): IdStatementBuilder { - return this.addRange(AttributesKeys.dob, MIN_DATE, getPastDate(age)); + return this.addRange(AttributesKeys.dob, MIN_DATE, getPastDate(age, 1)); } /** diff --git a/packages/common/src/web3Proofs.ts b/packages/common/src/web3Proofs.ts index a70d9aa67..e07ed9f2a 100644 --- a/packages/common/src/web3Proofs.ts +++ b/packages/common/src/web3Proofs.ts @@ -478,7 +478,7 @@ export class AccountStatementBuild extends AtomicStatementBuilder { return this.addRange( AttributeKeyString.dob, MIN_DATE, - getPastDate(age) + getPastDate(age, 1) ); }