I am using
momentJS in a project and I have a function that takes a
year and returns the last day of the month using those parameters.
Everything is working fine, Jan - November, and as soon as I use December, it is returning January.
Any ideas how I can tweak this to work? I am passing the true month value (5 = May) and then subtracting a month within the function to make it 0 based for moment to function correctly.
var startDate = moment([year, month]).add(-1,"month");
var startDate = moment([year, month-1]);
Basically, you don't want to start at the wrong point and then move by a month, you simply want to start at the correct point.