Is there any way to get all the Monday DATES in the current month using moment.js library.
I know I can get the end of the month with:
moment().endOf('month')
but how to get all monday dates of current / any month.
I dont want some function in javascript default date library. Please refer the code using Moment Js Library.
I know this is old but this is the first thing that comes up in Google.
You can get all the Mondays in the month by using my moment-weekdaysin moment.js plugin:
I've just read docs and haven't found any method that returns an array, so you need to do it only with loop
check this out
Update
I made a little drop in for this. Add it to your page:
And then:
etc - feel free to check out the source
Old Post
This function should work:
Usage:
getMondays()
for this month, orgetMondays(moment().month("Feb").toDate())
for a different month.From jabclab's Stack Overflow Answer, modified to include custom date param.