← Back to challenges

Impossible Date

JavaScriptHarddatesvalidation

Instructions

Given the parameters day, month and year, return whether that date is a valid date.

Examples

isValidDate(35, 2, 2020) ➞ false
// February doesn't have 35 days.

isValidDate(8, 3, 2020) ➞ true
// 8th March 2020 is a real date.

isValidDate(31, 6, 1980) ➞ false
// June only has 30 days.

Notes

N/A

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Bundle Up!