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:
For all date related activities I recommend using the moment.js library and as you are using AngularJS there is a library for this: https://github.com/urish/angular-moment.
Take a look at the moment.js documentation and you will see it makes it much easier to manipulate dates in JavaScript: http://momentjs.com/docs/#/get-set/month/
You will easily be able to solve the problem you are facing, for example:
var now = moment('01/01/2014').subtract(1, 'months').format('DD/MM/YYYY');
now would then equal 01/12/2013.
Hope this helps!