JSFiddle - React, Tailwind, and code Playground

by piyush saraf

HTML

<script src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.js"></script>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/ui-lightness/jquery-ui.css">
<div id='da'>

</div>
<div id='cur'>

</div>
<div id='pre'>

</div>

JavaScript

var MyDate = new Date();
var MyDateString;

MyDate.setDate(MyDate.getDate() + 20);

MyDateString = ('0' + MyDate.getDate()).slice(-2) + '/' + ('0' + (MyDate.getMonth()+1)).slice(-2) + '/' + MyDate.getFullYear();
document.getElementById('da').innerHTML  = MyDateString;

var d = new Date();
var Month2 =("0" + (d.getMonth() + 1)).slice(-2);
document.getElementById('da').innerHTML  = Month2;
var Month1 = d.getMonth();
Month1++;
document.getElementById('cur').innerHTML  = Month1;
					console.log(d);
					d.setMonth(d.getMonth() - 3);
          var Month = d.getMonth();
 document.getElementById('pre').innerHTML  = Month;
					console.log(d);
//alert(MyDateString);


                	var d = new Date();
                	var currentM =("0" + (d.getMonth() + 1)).slice(-2);
                	d.setMonth(d.getMonth() - 1);

                	var prevM =("0" + (d.getMonth() + 1)).slice(-2);
                	d.setMonth(d.getMonth() - 1);
                	
                	var lastM =("0" + (d.getMonth() + 1)).slice(-2);
					
					console.log(currentM);
					console.log(prevM);
					console.log(lastM);                	
                	
                	var Month1 = d.getMonth();
					Month1++;

					console.log(d);
					d.setMonth(d.getMonth() - 3);
					console.log(d);