You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
I haven't ran this to test, but from reading your snippet I think the issue is that the date returned after calling addDays could have skipped over the weekend. Checking if it is Saturday or Sunday only works if the result happened to be one of those day. If today is Wednesday, then adding 5 days puts it at Monday which is only 3 weekdays from then.
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 :
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
The text was updated successfully, but these errors were encountered: