Need to know if a date is invalid? Here’s how.
The new Date()
constructor will not throw an error if you pass it a wrong value, checking the value of the returned date object is the only way to know if the date is invalid.
Need to know if a date is invalid? Here’s how.
The new Date()
constructor will not throw an error if you pass it a wrong value, checking the value of the returned date object is the only way to know if the date is invalid.