Answers for "get all monday date in a month jquery"

0

get all mondays in calendar+js

function sundaysInMonth( m, y ) {
  var days = new Date( y,m,0 ).getDate();
  var sundays = [ 8 - (new Date( m +'/01/'+ y ).getDay()) ];
  for ( var i = sundays[0] + 7; i < days; i += 7 ) {
    sundays.push( i );
  }
  return sundays;
}

alert( sundaysInMonth( 10,2012 ) ); //=> [ 7,14,21,28 ]
alert( sundaysInMonth( 10,2012 ).length ); //=> 4
Posted by: Guest on October-05-2020
0

get all monday date in a month jquery

function mondaysInMonth(m,y) {
  var days = new Date(y,m,0).getDate();
  var mondays =  new Date(m +'/01/'+ y).getDay();
  if(mondays != 1){
    mondays = 9 - mondays;
  }
  mondays = [mondays];
  //console.log(mondays);
  for (var i = mondays[0] + 7; i <= days; i += 7) {
    mondays.push(i);
  }
  return mondays;
}
Posted by: Guest on May-03-2021

Code answers related to "get all monday date in a month jquery"

Code answers related to "Javascript"

Browse Popular Code Answers by Language