I would like to convert a string to date object and add in the last three month from the date to form a quarterly report using javascript.
For example, I am receiving the following string “August-2010” using the following
var currDate = "August-2010";
Based on the date, I will need to compute the last three months from the current date, for example:
July-2010
June-2010
May-2010
Lastly, I will need to format that result into an array in the following format:
[May,Jun,Jul,Aug];
How should I do it in Javascript?
This function returns the month+year of the last X months:
http://jsfiddle.net/SLcNJ/4/