Live: altsoph.com/pp/vc/
Code: github.com/altsoph/vacation_cheater
A few days ago I caught myself doing what I do every January — staring at a calendar, trying to figure out the optimal way to spend my vacation days. You know the drill: there’s a public holiday on Thursday, so if you take Friday off, you get a four-day weekend for the price of one vacation day. Multiply that across the whole year, and you can squeeze out quite a bit of extra free time.
The problem is, doing this manually is tedious and error-prone. You forget about regional holidays, you miss that perfect bridge day in October, and by the time you realize it, half your vacation budget is gone on suboptimal weeks. So I decided to vibe-code it.
The core idea is simple: find all the gaps between free days (weekends and public holidays) and fill the shortest ones first. It’s a classic greedy approach, and it works surprisingly well for this problem. Basically, it’s all about the metric, as always with optimization problems.
The optimizer runs in two phases:
Phase 1: Bridge days. Find all gaps shorter than 5 working days between free blocks. Sort them by length — shortest first, because a 1-day gap gives you the best return on investment. For gaps of equal length, prefer the ones flanked by the longest adjacent free blocks. Fill them until the budget runs out.
Phase 2: Full weeks. If there’s still budget left, look at the remaining gaps (5+ days) and sort them by efficiency — that is, the ratio of total days off in a row you’d get (including adjacent weekends) to the vacation days you’d spend. A week joined to another vacation week is better than an isolated week in the middle of nowhere.
That’s pretty much it. The algorithm is not particularly clever, but it does the job. In practice, it typically achieves something like a 2.5–3.5x efficiency ratio, meaning for every vacation day spent, you get 2.5 to 3.5 calendar days off.
This turned out to be the most annoying part. There’s no single reliable source of public holiday data for every country. I ended up using two APIs in parallel:
OpenHolidaysAPI — covers about 36 countries with proper regional subdivision support (German Bundesländer, Swiss cantons, US states, etc.). Generally more accurate.
Nager.Date — covers 100+ countries but without regional data.
Regional holidays turned out to be surprisingly important. In Germany alone, the difference between Bavaria and Berlin can be 4–5 extra holidays per year. If your optimizer doesn’t know which Bundesland you’re in, it’s essentially lying to you. Currently the app supports subdivisions for 6 countries: Germany (16 states), Austria (9), Switzerland (26 cantons), Australia (8 territories), Canada (10 provinces), and the US (50 states + DC).
The solution: fetch both, cross-reference, and mark any holiday found only in Nager.Date as “unconfirmed” with a visible warning. This way you see the full picture but know which days might be questionable. It’s not perfect, but it’s honest.
The whole thing is vanilla JavaScript — no React, no build tools, no npm install. Just an HTML file and a JS file. The only external dependency is html2canvas, which is lazy-loaded from a CDN only when you click the export button.
This was a deliberate choice. The app works from `file://`, it works offline (well, except for the holiday API calls), and it doesn’t track anything. Your vacation plans stay in your browser. The theme preference is saved to localStorage, and tht’s it.
I also added two color modes — as always the dark one is a terminal-inspired green-on-black palette with CSS text-shadow glow effects, because, well, why not.
Once you pick your country, year, and vacation budget, hit “Optimize” and the algorithm fills in the calendar. You can then fine-tune manually — click any working day to add or remove it from your vacation. The stats panel shows you how efficient your plan is: vacation days used, number of separate vacation blocks, longest streak, total days off, and the efficiency multiplier.
You can also export the whole thing as a PNG — handy for sharing with your family, colleagues or, you know, presenting your case to HR.
The app is live at my website and the code is on GitHub.
If you try it and find bugs, especially with holiday data for your country, feel free to make a PR. The dual-API approach is solid but not foolproof, and the more edge cases we catch, the better. There are several other potential things to be improved:
Multi-year planning — some people plan vacations across fiscal years or split budgets. A 2-year view could help.
Custom blocked dates — let users mark dates they can’t take off (deadlines, on-call rotations).
Shareable links — encode the vacation plan in a URL hash so people can share specific plans without exporting PNG.
iCal export — generate .ics files that can be imported directly into Google Calendar, Outlook, etc.
Weighted preferences — let users mark preferred months or seasons, so the optimizer prioritizes summer over winter (or vice versa).
There’s something slightly weird about optimizing leisure time with algorithms. But vacation days are a finite resource, and unlike most optimization problems, the payoff here is measured in actual days on a beach (or, more realistically, vibe-coding another pet-project on a couch).
No posts

Comments
Nothing yet. Say the first thing.
Sign in to join the conversation.