case 8: // Last Month Changed to -30Days //firstDay = new Date(filterdate.getFullYear(), filterdate.getMonth() - 1, 1); //lastDay = new Date(filterdate.getFullYear(), filterdate.getMonth(), 0); firstDay = new Date(); firstDay.setDate(firstDay.getDate() - 30); firstDay.setHours(0, 0, 0, 0); lastDay = new Date(); lastDay.setHours(23, 59, 59, 999); console.log(`First Day: ${firstDay}`); console.log(`Last Day: ${lastDay}`); break;