Challenge says seconds when it should be milliseconds

Tell us what’s happening:
Where the description says “You can create a variable ninetyDaysInSeconds = 90*24*60*60; to use for the timeInSeconds .”

Though the hint let’s us know the correct answer:
var ninetyDaysInMilliseconds = 90*24*60*60*1000

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36

Challenge: Ask Browsers to Access Your Site via HTTPS Only with helmet.hsts()

Link to the challenge:

it seems the hints are outdated, checking the documentation it confirms that the value is in seconds

https://helmetjs.github.io/

I will change the hint, thank you for reporting

Thank you for looking into this, though I was only able to pass the test when using what the hint said.

Thank you for helping make FCC better. Bugs can be reported as GitHub Issues. Whenever reporting a bug, please check first that there isn’t already an issue for it and provide as much detail as possible.

1 Like

According to the test it will match on both numbers.

assert.match(
  data.headers['strict-transport-security'],
  /^max-age=7776000;?/
);
console.log('max-age=7776000'.match(/^max-age=7776000;?/));
console.log('max-age=7776000000'.match(/^max-age=7776000;?/));

You do have to make sure you use the correct variable name though, timeInSeconds and ninetyDaysInSeconds are two different identifier names.

Pass the config object {maxAge: timeInSeconds, force: true}. You can create a variable ninetyDaysInSeconds = 90*24*60*60; to use for the timeInSeconds.

Both will pass
const ninetyDaysInSeconds = 90*24*60*60*1000;

app.use(helmet.hsts({maxAge: ninetyDaysInSeconds, force: true}))
const ninetyDaysInSeconds = 90*24*60*60;

app.use(helmet.hsts({maxAge: ninetyDaysInSeconds, force: true}))
1 Like

Thank you for looking into it, I realized I needed to change my version of helmet back to version 3.21.3 (was 2.3.0 ) as I was unable to pass a few of previous challenges using 3.21.3.

On version 2.3.0, using seconds

resulted in this:

But on 3.21.3 they both pass as you’ve stated

Do you remember which challenges?

None of the challenges should be failing with the required version that is asked for in the initial challenge. If they do, it’s a bug.

My apologies for the confusion. I went through the earlier challenges and everything is working as expected with my current replit, but I found that I needed to do a hard refresh (and/or refreshing my replit a few times) if I submitted a failing link before submitting a correct one.

No problem, just checking.

We do have bugs from time to time that needs fixing so do not hesitate to report anything you might think is a bug.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.