Thanks luke.watson3 - I am definitely not a champion coder and had to use a lifeline for this one. 😄
The tricky bit with this is that email syntax differs from xmerge syntax used in word templates. So while <:= dateutils.dateToStr(dateutils.getEndOfLastMonth(int(today)), format='%Y %B'):> works in a word document, it doesn't work in an email template.
For email try:
<:=datetime_merge.fromordinal(datetime_merge.toordinal() - 30).strftime('%Y %B'):>
⚠️ There is a limitation though - this code will merge the month based on the date that was 30 days ago (-30). So if the email is sent on the 15th of the month, you will likely get the result you are after, but if sent on the 31st day of a month, it won't work as expected.
Let me know if the code I provided doesn't do what you need it to and we can brainstorm some alternatives.
Otherwise, I'd love to hear from any expert coders out there who may have an alternative solution for email syntax that might work in this instance.
And while the answer to your specific question Luke, was not in our Community resources, for others who might be reading this - there is a reasonably comprehensive library of codes in the Xmerge Library in Community that can be useful when trying to source codes for your templates. I've also found the blog articles on the following website to be super useful in helping me understand how xmerge code functions - https://www.createsomething.com.au/blog/
And, while again it didn't help me in this particular instance - Chat GPT or similar has also helped me work out codes in the past!