You want to create the date "31st February", but it's JavaScript that's cursed?
Write a less side-effecty function.
function getMonthName(monthNumber) {
const date = new Date(2023, monthNumber - 1, 1);
return date.toLocaleString([], { month: 'long' });
}