Add a dedicated section explaining working day utilities with real-world examples
Problem
While exploring the documentation, I noticed that working day utilities (such as next/previous working day and related functions) are not clearly explained with practical, real-world examples.
This can make it difficult for new users to understand how to use these utilities effectively.
Why this matters
- Improves clarity for beginners and contributors
- Helps users quickly understand common use cases
- Reduces confusion around working day calculations
Proposed solution
Add a dedicated section in docs/examples.md that includes:
- Example for getting the next working day
- Example for getting the previous working day
- Example using custom holiday calendars
- Clear explanation of expected outputs
Additional context
I have been working on improving documentation for working day utilities and would be happy to contribute to this as well.
@Shalini828, what do you mean by "practical, real-world examples"? The available examples seem quite clear to me.
I think by “practical, real-world examples”, it could mean demonstrating how these utilities are used in common real-life scenarios, such as:
- Finding the next working day after applying for leave around a holiday period
- Calculating deadlines that skip weekends and public holidays
- Planning business days across different regions with different holiday calendars
- Checking previous working day for financial/reporting purposes
These kinds of examples might help users relate better to actual use cases. Just sharing a possible interpretation.
- Finding the next working day after applying for leave around a holiday period
That'sget_nth_working_day(date, 1) (or a negative number for previous ones; pending documentation update PR for this is #3369)
- Calculating deadlines that skip weekends and public holidays
That'sget_working_days_between(start_date, end_date)
- Planning business days across different regions with different holiday calendars
Yes, we can already add holidays between different regions together i.e.
>>> north_america = holidays.CA() + holidays.US() + holidays.MX()
>>> north_america.get('2014-07-01')
"Canada Day"
>>> north_america.get('2014-07-04')
"Independence Day"
- Checking previous working day for financial/reporting purposes
See (1)
Anyway, if you're just getting started, a great way to find meaningful contributions is by exploring real-world use cases - there's plenty of opportunity to build something genuinely useful.
Even though we've already reached feature parity with the old workalendar project (though I haven't checked its newer forks yet), looking through other Python-based project or those in other languages with similar themes wouldn't hurt as well be it big new feature or small QoL changes.
Hi, based on the discussion, I’m planning to add a dedicated section in the documentation for real-world use cases of working day utilities.
I’m thinking of structuring it around practical scenarios such as leave planning, deadline calculations, multi-region scheduling, and financial/reporting workflows, with concise explanations and code examples for each.
For implementation, I’ll introduce a new section in the docs and include clear, minimal examples using existing functions like get_nth_working_day and get_working_days_between, focusing on readability and real-world relevance.
The goal is to make the utilities easier to understand from a practical perspective.
Please let me know if this approach aligns with what you had in mind or if you’d like any changes.
if this approach aligns with what you had in mind or if you’d like any changes
I still don't see what important stuff could be added to existing examples. Please give at least one "example of examples". :)
Thanks for the clarification — that helps.
One example I’m considering is a leave-planning scenario where we calculate the minimum number of leave days needed around a holiday period by skipping weekends and public holidays.
This would show how the utilities can be combined to solve a practical planning problem rather than just using individual functions.
Let me know if this is closer to what you had in mind.
I'd like to see exactly how this should look in the documentation.
Got it — thanks, that helps clarify what you're looking for.
Here’s a concrete example of how the documentation section could look:
Example: Planning Leave Around Holidays
Scenario: You want to apply for leave from July 3 to July 7, but you want to understand how many working days this actually consumes, considering weekends and public holidays.
import holidays
from datetime import date
from holidays.utils import get_working_days_between, get_nth_working_day
us_holidays = holidays.US()
start = date(2024, 7, 3)
end = date(2024, 7, 7)
working_days = get_working_days_between(start, end, holidays=us_holidays)
print(working_days)
Output:
2
Explanation:
- July 4 is a public holiday (Independence Day)
- Weekend days are excluded
- So only July 3 and July 5 are counted as working days
Example: Finding Next Working Day After Leave
next_working = get_nth_working_day(date(2024, 7, 4), 1, holidays=us_holidays)
print(next_working)
Output:
2024-07-05
The goal with examples like this is to:
- Show how multiple utilities work together
- Tie them to real use cases (leave planning, deadlines, etc.)
- Make expected outputs and reasoning very clear
Let me know if this is closer to what you had in mind — happy to refine further
Note that there's an existing list_long_breaks feature (#3001)
that’s really helpful.
In that case, it might be even more useful to incorporate list_long_breaks into the example itself, so users can see how to directly identify optimal leave periods rather than manually comparing date ranges.
For example, instead of just computing working days, we could show how to use list_long_breaks to discover extended break opportunities and then relate that back to leave planning decisions.
This would make the example more aligned with existing functionality while still keeping it practical and scenario-driven.
Let me know if this direction makes more sense.
Hi, I'm Hana, a data analyst interested in contributing to this issue for GSoC 2026.
I'd like to help by adding clear real-world examples for working day utilities (like leave planning or deadlines).
I can start by drafting a simple example section with code and explanations. Please let me know if that would be helpful.