Script: LastMonth - jobisoft/quicktext GitHub Wiki
This script gets the name of the previous calendar month.
It is a special case of the community script DateOffset that does the same with:
[SCRIPT=DateOffset](/jobisoft/quicktext/wiki/0|-1|monthname)
Script
const months = ["December", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November"];
var date = new Date();
return months[date.getMonth()];
Usage
Here's one example, in the event you are self-employed and bill your clients monthly:
Please find an invoice for [SCRIPT=LastMonth](/jobisoft/quicktext/wiki/SCRIPT=LastMonth) attached.
would resolve to:
Please find an invoice for February attached.
French variants
I also have a French variant of this script which essentially replaces "December" with "décembre" and so on, and a "French possessive" variant which instead uses "de décembre" (in order to account for contractions in months that begin with a vowel, e.g. "d'avril").