mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-06-16 21:06:35 +08:00
fix(curriculum): approximate lab-date-conversion test (#56468)
Some checks failed
CI - E2E - 3rd party donation tests / Build & Test (20.x) (push) Has been cancelled
CI - Node.js / Lint (20.x) (push) Has been cancelled
CI - Node.js / Build (20.x) (push) Has been cancelled
CI - Node.js / Test (20.x) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (20.x) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 20.x) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 20.x) (push) Has been cancelled
Some checks failed
CI - E2E - 3rd party donation tests / Build & Test (20.x) (push) Has been cancelled
CI - Node.js / Lint (20.x) (push) Has been cancelled
CI - Node.js / Build (20.x) (push) Has been cancelled
CI - Node.js / Test (20.x) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (20.x) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 20.x) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 20.x) (push) Has been cancelled
This commit is contained in:
parent
63359ff234
commit
1e48c21cf5
@ -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: <ddd> <MMM> <dd> <yyyy> <HH>:<mm>:<ss> <TIMEZONE>`.
|
||||
|
||||
```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.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user