Horje
how to calculate first monday of the month in js Code Example
how to calculate first monday of the month in js
function lastDayOfMonth(y,m,dy) {
 var  days = {sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6}
     ,dat = new Date(y+'/'+m+'/1')
     ,currentmonth = m
     ,firstday = false;
  while (currentmonth === m){
    firstday = dat.getDay() === days[dy] || firstday;
    dat.setDate(dat.getDate()+(firstday ? 7 : 1));
    currentmonth = dat.getMonth()+1 ;
  }
  dat.setDate(dat.getDate()-7);
  return dat;
 }
// usage 
lastDayOfMonth(2012,2,'tue'); //=>Tue Feb 28 2012 00:00:00 GMT+0100
lastDayOfMonth(1943,5,'fri'); //=>Fri May 28 1943 00:00:00 GMT+0200




Javascript

Related
cy.contains Code Example cy.contains Code Example
loops in javascript Code Example loops in javascript Code Example
opencv rtsp stream python Code Example opencv rtsp stream python Code Example
update html text Code Example update html text Code Example
range between two numbers Code Example range between two numbers Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7