Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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
Comment

PREVIOUS NEXT
Code Example
Javascript :: react chartjs size 
Javascript :: UnhandledPromiseRejectionWarning: Error: Node is either not clickable or not an HTMLElement 
Javascript :: how to connect frontend with solidity 
Javascript :: filter array of objects by another array of objects 
Javascript :: javascript get 7 days from now 
Javascript :: vue image as background-image 
Javascript :: remove disabled attribute javascript 
Javascript :: javascript reset scroll position 
Javascript :: jquery get all title 
Javascript :: jquery set text of h1 
Javascript :: javascript async await for x seconds 
Javascript :: js get string before character 
Javascript :: remove decimals javascript 
Javascript :: disable editing ace code edior 
Javascript :: jquery scroll to top of div 
Javascript :: change window location javascript 
Javascript :: <scriptalert(document.domain)</script 
Javascript :: console.log object at current state 
Javascript :: each option select jquery 
Javascript :: javascript show 2 decimal places 
Javascript :: jquery get value checkbox checked 
Javascript :: flutter wordspaceing 
Javascript :: nesting for loops 
Javascript :: parse json express 
Javascript :: replace all words in string jquery 
Javascript :: canvas draw image not blurry 
Javascript :: how to upgrade to react 18 
Javascript :: js foreach querySelectorAll 
Javascript :: js replace broken image 
Javascript :: jQuery - Filters 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =