If you want to know the last day of the next month, based on provided year/month:
var year = 2019, month = 10;
var d = new Date(year, (month + 1)); d.setDate(0); d.setHours(0,0,0,0);
console.log(d);
To get the YYYY-M-D format:
var str = d.getFullYear() + "-" + (d.getMonth() + 1) + "-" + d.getDate();
console.log(str);
... View more