From 1e48c21cf5bc662d196dfd866fca312a4c7df97d Mon Sep 17 00:00:00 2001 From: Shaun Hamilton Date: Sat, 5 Oct 2024 13:20:04 +0200 Subject: [PATCH] fix(curriculum): approximate lab-date-conversion test (#56468) --- .../lab-date-conversion/66f686b8ebdb982fa8e14330.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/curriculum/challenges/english/25-front-end-development/lab-date-conversion/66f686b8ebdb982fa8e14330.md b/curriculum/challenges/english/25-front-end-development/lab-date-conversion/66f686b8ebdb982fa8e14330.md index 1cdd9939acc..4afb26e2706 100644 --- a/curriculum/challenges/english/25-front-end-development/lab-date-conversion/66f686b8ebdb982fa8e14330.md +++ b/curriculum/challenges/english/25-front-end-development/lab-date-conversion/66f686b8ebdb982fa8e14330.md @@ -40,13 +40,16 @@ const currentDateOnly = new Date(currentDate.getFullYear(), currentDate.getMonth assert.equal(currentDateOnly.toString(), expectedDateOnly.toString()); ``` -You should have a variable named `currentDateFormat` that holds the current date in the format `Current Date and Time: [current date]`. +You should have a variable named `currentDateFormat` that holds the current date in the format `Current Date and Time:
:: `. ```js const expectedDate = new Date(); -const expectedDateFormat = `Current Date and Time: ${expectedDate}`; +const expectedDateString = `Current Date and Time: `; +assert.include(currentDateFormat, expectedDateString); -assert.equal(currentDateFormat, expectedDateFormat); +const currentTimestamp = new Date(currentDateFormat.replace(expectedDateString, '')).getTime(); +const expectedTimestamp = expectedDate.getTime(); +assert.approximately(currentTimestamp, expectedTimestamp, 1000); ``` You should log the value of `currentDateFormat` to the console.