From 36a6c0e5ec94282c64726e9933523a9769ba434c Mon Sep 17 00:00:00 2001 From: Fredrik Forsmo Date: Thu, 14 Mar 2024 11:39:36 +0100 Subject: [PATCH] Fix ageDate test --- test.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test.ts b/test.ts index ea8c6fe..2941e2a 100644 --- a/test.ts +++ b/test.ts @@ -164,7 +164,9 @@ describe('personnummer', () => { day = '' + (parseInt(day) - 60); } - const ageDate = `${year}-${month}-${day < 10 ? '0' : ''}${day}`; + const ageDate = `${year}-${month}-${ + ('' + day).length < 2 ? '0' : '' + }${day}`; const personnummerDate = new Date(ageDate); availableListFormats.forEach((format) => {