JSFiddle - React, Tailwind, and code Playground
HTML
<h1 id="month"></h1>
<button id="btn">Previous Month</button>
JavaScript
var date = new Date();
var gMonth = date.getMonth();
var sMonth = date.setMonth(date.getMonth());
var assignMonth = $('#month').append(gMonth);
var prvMonth = function(){
var sMonth = date.setMonth(date.getMonth()-1);
console.log(sMonth);
}
$('#btn').on("click", prvMonth);
console.log(gMonth);
console.log(sMonth);