I’m new to javascript. I’m trying to validate a date and find that the code below, when given feb 31
returns mar 2
. Why is it “fixing” the date instead of returning an error? Is there not a builtin that will return an error for such non-existing dates?
let dateObj = new Date(2024, 1, 31, 0, 0, 0);
console.log("dateObj", dateObj);