Back to writing

London, Ontario

6 min read

How Holiday Optimizer plans your time off

The small dynamic program behind it, why the holiday calendar is harder than the algorithm, and what happened when the press found it.

Canada Day falls on a Thursday in 2027. Take the Friday off and you’re away from work from Thursday to Sunday: four days for one day of leave.

Canada Day 2027 is a Thursday. One day of leave on the Friday joins it to the weekend: four days off.

Everyone knows that trick. Doing it for a whole year is where it gets tedious: every holiday, every weekend, a fixed number of leave days, and no wish to spend them all in one month. That’s what Holiday Optimizer does. You tell it how many days you have and where you live, and it hands back a plan.

Here’s how it works, and what happened once people started using it.

The year as a row of days

The optimizer starts by laying out the year one day at a time. Each day is either free (a weekend, a public holiday, a company day off) or a workday, which costs one day of leave if you take it off.

A break is a run of consecutive days. What it costs is the number of workdays inside it; what you get is its length. The job is to pick breaks that add up to as many days off as possible without spending more leave than you have.

Why not grab the best deals first?

The obvious approach is greedy: find the break with the best ratio of days off to leave spent, take it, repeat.

The trouble is the rules. Breaks need some space between them, so the time off is spread across the year. And the strategy you pick decides which lengths count, so someone who wants week-long trips doesn’t get handed a pile of long weekends. Once those rules exist, taking one break changes which others are allowed, and a greedy pick can use up the room that two better breaks needed.

A small dynamic program

So the optimizer considers every option, without doing any work twice. Standing on a given day with some leave left, there are only two moves:

  • skip the day, or
  • start a break here, of any length the strategy allows, pay for its workdays, and jump ahead by the minimum gap.

The best plan from here is the better of the two. The same question (this day, this much leave) comes up again and again, so the answer is saved the first time it’s worked out. That’s dynamic programming: a recursion plus a memo.

Underneath is a running count of workdays since the start of the year, so the cost of any break is one subtraction. For a year and 20 days of leave that’s about 365 × 20 states, each trying up to 15 break lengths: roughly a hundred thousand steps, which takes a few milliseconds. It’s quick enough to run in the page, so there’s no server doing the maths.

Strategies are two settings

Each strategy is just two settings: which break lengths it allows, and the minimum gap between breaks.

StrategyBreak lengthsGap between breaks
Long weekendsup to 4 daysa week
Mini breaks5–6 daystwo weeks
Week-long breaks7–9 daysthree weeks
Extended vacations10–15 daysa month
Balancedanything up to 15 daysthree weeks

Every strategy also allows one- or two-day breaks, so a stray holiday never goes to waste.

For Ontario in 2027, with 10 days of leave, “balanced” finds 37 days off in ten breaks. Mini breaks find 25 days in five, week-long breaks 24 days in four, and extended vacations 20 days in two. Counting days alone, lots of long weekends win. The strategies exist because a week in September can be worth more than three extra Mondays.

The balanced plan for Ontario in 2027: 10 days of leave, 37 days off.

Every break in that plan costs exactly one day. Seven of them sit beside a holiday: New Year’s, Family Day, Good Friday, Victoria Day, Canada Day, Labour Day and Thanksgiving. Two are plain long weekends, in August and November, and the last is Christmas.

The free days it couldn’t see

There’s one wrinkle. A strategy that only allows five- or six-day breaks can’t choose a three-day window, so a break could end on a Friday with the weekend sitting right there, unclaimed.

The fix is a small pass after the search: every break grows over any weekends, holidays or company days next to it. They’re free, so the leave count doesn’t change.

The calendar is the hard part

The algorithm has barely changed since January. The holiday data never stops changing.

Look at the end of that plan. In 2027, Christmas Day and Boxing Day both fall on a weekend. In Ontario you’re owed substitute days for them, but your employer picks the dates, so the site asks you to add them rather than guess. Left alone, the plan spends a day of leave on Monday the 27th.

Provinces disagree, too. Quebec doesn’t require Boxing Day; British Columbia adds Remembrance Day. And weekends aren’t Saturday and Sunday everywhere, so those are a setting as well. That’s why, for the places it covers most closely, the site keeps its own curated list on top of the open-source date-holidays library.

Then the press found it

People first found it through my two launch posts on r/SideProject, in March and November 2025, which got about 1,600 and 1,500 upvotes. After that it spread by word of mouth, and then articles started to pick it up.

Travel + Leisure used Holiday Optimizer’s numbers in a December 2025 piece on stretching your leave in 2026: 11 vacation days, planned well, could come to 41 days off. The Washington Post mentioned it in January, and Real Simple described it in March.

I found out about most of these through PostHog, when visits started arriving from their sites. Now and then I also search Google for the domain and the project’s name, filtered to the past week or month, to see if anything new has turned up.

If you want to try it, it’s at holiday-optimizer.com. The case study has the rest: the stack, and why I built it.

Waqar