Use Moment to get month of Date object
You can use moment.month()
it will return or set the value.
moment.month()
is zero based, so it will return 0-11 when doing a get and it expects a value of 0-11 when setting passing a value in.
var d = moment(scope.date);
d.month(); // 1
d.format('ddd MMM DD YYYY'); // 'Mon Feb 01 2016'
As moment.month()
returns zero based month number you can use moment.format()
to get the actual month number starting from 1 like so
moment.format(scope.date, 'M');