function getMonthName(monthNumber) {
const date = new Date();
date.setMonth(monthNumber - 1);
return date.toLocaleString([], { month: 'long' });
}
function getMonthName(monthNumber) {
const date = new Date();
date.setMonth(monthNumber - 1);
return date.toLocaleString([], { month: 'long' });
}
In Ruby (with ActiveSupport) I would do something like
4.days.from_nowor30.days.from_now.If I really needed “one month from now” on some specific day of the month that not every month has I’d do:
def 31st_of_next_month next_month = (Time.current.end_of_month + 1.day).beginning_of_month day = next_month + 31.days return day if day.month == next_month # last day of month if no 31st next_month.end_of_month.beginning_of_day endDisclaimer: I’m laying in bed typing this on mobile. The code probably sucks but I’m writing for illustrative purposes.