function isLastDayOfMonth(dt) {
// 86,400,000 milliseconds = 1000 * 60 * 60 * 24 = 1 day
return new Date(dt.getTime() + 86400000).getDate() === 1;
}
console.log(isLastDayOfMonth(new Date('2022-04-30')));
console.log(isLastDayOfMonth(new Date('2022-04-29')));
/*
run:
true
false
*/