Add two business days set the due date

My Current logic is:
If tomorrow is Saturday, set due date 4 days from now
If tomorrow is Sunday, set due date 3 days from now
Everything else, set due date 2 days form now.

Not sure how to do this and set a formula for it in the due date creating a click up task. The code is straight forward but I can’t find a Today() or Tomorrow() or weekday() function. Thank you for the help.

All time-related functions can be found under the calendar icon pictured below. You can use formatdate and now functions to get current day then embed use the switch function (or a switch module depending on your workflow) to create the desired result. Hopefully that makes sense but shout if you want more help.

1 Like

Hi. You can find the current week day only doing this below. Then you can use the add days function as you want to build your flow:

{{formatDate(now; “dddd”)}}

If you need additional support, please don’t hesitate to reach out.

Cheers
//HFBR

2 Likes

Used now and created a variable that has the date as a number 1-7 then I used the switch function to create a duel if statement this was the solution.

Hey everyone, even though this topic has been solved, I thought it’s a nice and potentially recurring problem other people might want to solve so I would like to share my complete solution for the ones who might find it useful.

For getting the day of a week which would be 2 days from now but would skip weekend you could use following formula:

{{switch(formatDate(now; "dddd"); 
"Thursday"; formatDate(addDays(now; 4); "dddd"); 
"Friday"; formatDate(addDays(now; 3); "dddd"); 
formatDate(addDays(now; 2); "dddd"))}}

For getting the actual date which would be 2 days from now but would skip weekend you could use this formula:

{{switch(formatDate(now; "dddd"); 
"Thursday"; formatDate(addDays(now; 4); "dddd"); 
"Friday"; formatDate(addDays(now; 3); "dddd"); 
formatDate(addDays(now; 2); "dddd"))}}

Both formulas are using “switch” function to switch between possible cases, formatDate function to format the date and addDays function to add the respective number of days to current date.

Attaching also a blueprint where results of both of these functions are eventually sent as a slack message.
Due Date Day calculation blueprint.json (10.1 KB)

Cheers.
Jan

2 Likes

Yup exactly the same solution I got. Perfect use case for Switch Function in a little more of a complex case.