How to get javascript to throw error on bad date input?

Viewed 21
console.log(new Date("2000-02-31"));

The above will work. It will it convert to 2000-03-02T00:00:00.000Z.

How do I override this behavior and get it to throw an error on garbage input?

0 Answers
Related