function getMonthName(monthNumber) {
const date = new Date();
date.setMonth(monthNumber - 1);
return date.toLocaleString([], { month: 'long' });
}
You must log in or register to comment.
I would expect the month to increment by one and the day to be clamped to the valid days for the month.
That’s precisely what I’d expect as well, and what APIs in languages like Java do.