# \[Solved\] Rules: Calculate due date X days after trigger, but only count work-days, no weekends

**URL:** https://community.fibery.io/t/solved-rules-calculate-due-date-x-days-after-trigger-but-only-count-work-days-no-weekends/4439
**Category:** Get Help
**Created:** [May 11, 2023, 4:21pm UTC](https://community.fibery.io/t/solved-rules-calculate-due-date-x-days-after-trigger-but-only-count-work-days-no-weekends/4439 "2023-05-11T16:21:14Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![anna](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/anna/32/9005_2.png) [@anna](https://community.fibery.io/u/anna)
#### Post date: [May 11, 2023, 4:21pm UTC](https://community.fibery.io/t/solved-rules-calculate-due-date-x-days-after-trigger-but-only-count-work-days-no-weekends/4439/1 "2023-05-11T16:21:15Z")

</div>

Hi!

I’ve created an automation that adds `To dos` (Database “To do”) to an entity, when the entity’s status is updated. I want to update my rule so it calculates and set’s the `Due date` for the `To do`.

The `Due date` should be X days after the rule was triggered - but I don’t want the date to end up on the weekend, so Saturdays and Sundays shouldn’t count. Only work-days (Monday-Friday; Monday-Thursday for some people on my team) should count.

For example:

- Rule is triggered on a Friday

- Rule creates a `To do` with `Name` “ABC”, assigns `assignee` from Step 1, sets `Due date` for “2 working days after trigger” → **`Due date` is set for the following Tuesday and not for Sunday.**

Can anyone help?

Thank you!

---

<div class="post-metadata">

### Author: ![Matt\_Blais](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/matt_blais/32/1464_2.png) [@Matt\_Blais](https://community.fibery.io/u/Matt_Blais)
#### Post date: [May 11, 2023, 6:16pm UTC](https://community.fibery.io/t/solved-rules-calculate-due-date-x-days-after-trigger-but-only-count-work-days-no-weekends/4439/2 "2023-05-11T18:16:11Z")

</div>

Formulas have the **WeekDayName** function to find the weekday of a particular date: [WeekDayName function](https://the.fibery.io/@public/User_Guide/Guide/Formulas-reference-44/anchor=WeekDayName(date,-format-)--95a09e20-f6f7-4f84-a000-b91c67d6dc39)

If you need to consider holidays, that’s a job for a script, and you might want to interface with an external service - maybe check this: [rest api days holidays calculator - Google Search](https://www.google.com/search?q=rest+api+days+holidays+calculator&oq=rest+api+days+holidays+calculator)

For the simplest case, Due Date = Today plus two business days, this should work:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/c/c29447dd1b75c2281142ebd199ab33348a2bd79b.png)

```auto
Today() + Days(
  If(WeekDayName(Today(),"Day") = "Thursday", 4,
  If(WeekDayName(Today(),"Day") = "Friday", 3,
  2)))

```

---

<div class="post-metadata">

### Author: ![anna](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/anna/32/9005_2.png) [@anna](https://community.fibery.io/u/anna)
#### Post date: [May 12, 2023, 11:22am UTC](https://community.fibery.io/t/solved-rules-calculate-due-date-x-days-after-trigger-but-only-count-work-days-no-weekends/4439/3 "2023-05-12T11:22:40Z")

</div>

Thanks so much Matt! This is perfect 😊

---

<div class="post-metadata">

### Author: ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)
#### Post date: [November 1, 2023, 2:16pm UTC](https://community.fibery.io/t/solved-rules-calculate-due-date-x-days-after-trigger-but-only-count-work-days-no-weekends/4439/4 "2023-11-01T14:16:56Z")

</div>

It’s a bit late to revive this topic, but you could potentially leverage an external API to calculate an offset of X working days, in a similar way to what is discussed [here](https://community.fibery.io/t/working-days-in-calendar-month/698/3).
