Set a Future Date, Skipping Weekends

The context is a to-do (Action) list system. Some Actions, when done, will trigger another instance of the completed Action with DateDue on a future date. How far in the future may be a number of days or weeks or months. Assigning a new date exactly n days or weeks or months in the future us easy. In many cases, I’ll want the system to skip over weekends, setting the date to the next Monday. (In reality, I’ll eventually want a holiday calendar so I can skip over holidays as well, but that’s not something I want to deal with right now.)

In the workflow for updating the current Action to show that it’s closed, I can create a new Action. It’s easy enough to duplicate the Action’s name, set the status value, etc. How can I assign the DateDue value to a future date without landing on a weekend?

I’m starting to think of some convoluted ways to go about this but I want to keep it as simple as possible.

You may find that this post provides an answer.

Thanks, Dan. I’ll study this and give it a go.

I don’t think this will work when I am ready to skip over holidays. That will require a holiday calendar but the Air Date/Time Picker approach may get me started.

True, it likely wont work for the holidays part. But here’s a quick idea: you could create holidays as a database record that works in tandem with this. (Ie. a holiday has the fields of name and date. Add in a boolean field is_weekend (or is_excluded) and account for any matching holidays within that range in the total days out.

By having holidays as their own object, this gives a little bit of control over which holidays are accounted for (based on country, etc).

1 Like


Hopefully I’ll have time this weekend to put this idea to the test.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.