var today = new Date();
var monthNames = ["January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"];
var currentMonthIndex = today.getMonth();
var lastMonthIndex = 0;
if (currentMonthIndex === 0) {
lastMonthIndex = 11;
} else {
lastMonthIndex = currentMonthIndex - 1;
}
var lastMonthName = monthNames[lastMonthIndex];
console.log(lastMonthName);
Text_Box.applyText("Data set to current month -1:"+" "+"("+lastMonthName+")");
Code language: JavaScript (javascript)