If i have a variable that returns a date, in the format of dd MMM yyyy, so 28 Aug 2014, how can i get the date of the previous month.
I can modify the month via:
There is my way to get previous months.
const formatter = new Intl.DateTimeFormat("default", { month: "long" }); const date = new Date(); let number = 1; let prevMonth = formatter.format( new Date(date.getFullYear(), date.getMonth() - `${number}`) );