datejs icon indicating copy to clipboard operation
datejs copied to clipboard

Add business days

Open marcwales opened this issue 3 years ago • 0 comments

Hi,

I hope this is still active, i was using the original datejs for years but now i see this upgrade which i needed since the beginning ;) I just can't seem to make it work. Here is the original code :

  <script>
  var fromDate = Date.today().addDays(5);
  if (fromDate.is().saturday() || fromDate.is().sunday()) { 
  fromDate = fromDate.next().monday();
  }
  var toDate = Date.today().addDays(10);
  if (toDate.is().saturday() || toDate.is().sunday()) { 
  toDate = toDate.next().monday(); 
  }
  document.getElementById('fromDate').innerHTML = fromDate.toString('dddd dd-MM-yyyy');
  document.getElementById('toDate').innerHTML = toDate.toString('dddd MMMM dS');
  </script> 

I tired to change this : var fromDate = Date.today().addWeekdays(5);

But it doesn't work.

Hope someone can help me on this.

Rgds, Marc

marcwales avatar Nov 17 '21 13:11 marcwales