In a function...
const selectedDate = new Date(msg.payload); //assuming date picker date is in msg.payload
const month = selectedDate.getMonth();
const year = selectedDate.getFullYear();
//msg.payload = new Date(year, month, 0).getDate(); //returns 31 for this month
//msg.payload = new Date(year, month, 0); //returns date object for last day of month
return msg;
Or
const selectedDate = new Date(msg.payload); //assuming date picker date is in msg.payload
const month = selectedDate.getMonth();
const year = selectedDate.getFullYear();
msg.payload = daysInMonth(month+1, year);
return msg;
/** month 1 = Jan */
function daysInMonth(iMonth, iYear)
{
return 32 - new Date(iYear, iMonth - 1, 32).getDate();
}