Getting the previous month's first date from current date in JavaScript
Solution 1:
Straightforward enough, with the date methods:
var x = new Date();
x.setDate(1);
x.setMonth(x.getMonth()-1);
Solution 2:
Simplest way would be:
var x = new Date();
x.setDate(0); // 0 will result in the last day of the previous month
x.setDate(1); // 1 will result in the first day of the month