If you create an override of the calendar template and insert the JavaScript code at the end, the effect will remain also after the update. This is the better solution, because this way you can avoid a core hack
Just insert:
Code:
<script>
document.addEventListener('DOMContentLoaded', function() {
// Specifically target the td.monthname element within div.jem_calendar and table.month
const monthname = document.querySelector('.jem_calendar table.month td.monthname');
// If the element was found
if (monthname) {
// Extract and split the text
const text = monthname.innerText;
const parts = text.split(' ');
// If the format is correct (month year)
if (parts.length === 2) {
// Swap the parts and join them back together
monthname.innerText = `${parts[1]} ${parts[0]}`;
}
}
});
</script>