You can use the below format to get the right result:
// parse a date in yyyy-mm-dd format
function parseDate(input) {
let parts = input.split('-');
// new Date(year, month [, day [, hours[, minutes[, seconds[, ms]]]]])
return new Date(parts[0], parts[1]-1, parts[2]); // Note: months are 0-based
}
Basically, with the newer edition, this date.parse returns as a number rather than as a date.
I hope this will help.
Want to become a Java Expert? Join Java Course now!!
Want to know more about Java? Watch this tutorial on Java Course | Java Tutorial for Beginners: