In Moment.js, why doesn't subtract by 'week' work?
javascript, momentjs
Solution
You have it backwards from the Moment API.
moment().subtract(1, 'week');
Problem
I'm using `Moment.js` and following line of code doesn't seem to actually do anything: ``` moment().subtract('week', 1) ``` In the documentation, it shows an example of subtract being used with `'days'` but it doesn't specify that it's the only string you can use. In most of the other functions, it's an option where you can use `'days'`, `'weeks'`, `'months'`, so I'm not sure if I'm doing something wrong or `'weeks'` just isn't supported: Moment.js Subtract Documentation Here's the example of subtracting days: ``` moment().subtract('days', 7); ``` It's also what I ended up using instead of `'weeks'` but I'm still curious why `'weeks'` aren't supported.