Services Plugins FAQs

Calculating Working Days Without Weekends and Holidays

If you need to calculate working days in your project, it might seem straightforward at first. However, you may realize, “Wait, we have to skip weekends, take holidays into account, and maybe even handle custom days off.” It can get a little tricky. While searching the Bubble forum, many have had the same questions, so here are some findings that might help you.

There’s a plugin that simplifies the process and lets you include a list of public holidays to exclude. It’s simple to use, so it can save time for anyone working on a similar project.

Problem 1: Selecting the Start Date

You need a way to set the start date for counting working days. The plugin comes with an element where you insert the dynamic data of the start date. Basically, you select the start date for day counting, and the counting starts from the next day. You can use any date picker value here.

image

Problem 2: Specifying the Number of Working Days

Next, you need to input the number of working days you want to calculate. You can use an input value for the days to count, which can be any value from your database or user input. This allows you to customize the duration based on different project requirements.

image

Problem 3: Skipping Weekends

Then you may need to skip weekends. By default, you can use fields with the “Skip” prefix to exclude specific weekdays from counting, similar to checkboxes. Alternatively, you can use the “Weekdays to skip” field where you send comma-separated values of the indexes of weekdays you want to skip. To enable this option, set “Enable Weekdays” to “Yes”. For example, entering 2,5,6 means you want to skip:

  • 2 - Tuesdays
  • 5 - Fridays
  • 6 - Saturdays

This flexibility is great for customizing which days to exclude based on your work schedule.

image

Problem 4: Excluding Specific Dates (Holidays)

You may also need to exclude specific dates, like holidays. The plugin allows you to indicate a list of dates that will be skipped from counting. These days are excluded only once, which is perfect for holidays or one-time events that shouldn’t be counted as working days.

image

Problem 5: Calculating Total Calendar Days Including Skipped Days

Finally, you might want to know the total calendar days needed to complete the indicated number of working days. The plugin calculates this for you. In the “Total Days” state, it returns the number of days you specified in the “Days” field plus the number of days that were skipped. This is super helpful for setting realistic deadlines.

I hope this helps anyone facing the same challenge. If you have other ways to solve this or any tips, please share them so we can all help each other!

1 Like