Method: how Ledigt finds bridge days
Where the holiday data comes from, which days count as free, and how Ledigt searches for the best breaks and builds a plan for your leave days.
Denne side er skrevet på engelsk.
Data source
Holiday dates come from Nager.Date, an open public holiday API: https://date.nager.at/api/v3/PublicHolidays/{year}/{countryCode}. Ledigt does not calculate or edit holiday dates. Each snapshot is committed to the repository as data/klamdagar/{COUNTRY}-{YEAR}.json with the source URL and the time it was fetched, and every calendar page shows that time.
The site never calls Nager.Date from your browser. The snapshots are read when the site is built, and a scheduled job fetches fresh copies. If a fetch fails, the previous snapshot stays in place.
Denmark is requested with the country code DK. The code DA is the Danish language code and returns no holidays.
What counts as a free day
A day is free when it is one of these:
- A Saturday or a Sunday.
- A holiday that Nager.Date types as Public. Bank, School, Authorities, Optional and Observance days are ignored.
- A holiday that applies everywhere (Nager.Date marks it global) or that is listed for every region of the country, or one listed for the region you selected.
Finding the breaks
Consecutive free days form a block. A leave window starts at the first day of one block and ends at the last day of a later block. The workdays between the two blocks are the leave days. Because both ends are whole blocks, no leave day is wasted on the edge of a break.
Ledigt generates every window that needs 15 leave days or fewer, then keeps those that start in the year you are viewing. A window can run into the following year when that year's snapshot exists, so the Christmas break in 2026 extends to 3 January 2027.
Each window is scored as days off in a row divided by leave days used. Runs of three or more free days that contain a public holiday and need no leave are listed separately as long weekends.
Building the plan
The plan answers a different question: given N leave days, which breaks together give the most days off? Ledigt solves it exactly with dynamic programming over the windows sorted by end date, a weighted interval scheduling problem with a leave-day budget. Chosen breaks never overlap. If two plans give the same number of days off, the one that spends fewer leave days wins.
The plan can differ from the top of the ratio list. Several four-day bridges beat one long break on total days off, but one long break may suit a real holiday better. Select any break in the list to see it in the calendar.
Limits you should know
- Windows are limited to the dates covered by the loaded snapshots: 1 January 2026 to 31 December 2027. A break that would start before 1 January 2026 or continue after 31 December 2027 is cut at that edge.
- Saturday and Sunday are the weekend in every country listed. Shift patterns are not modelled.
- Employer-specific days, local municipal holidays and religious observances that Nager.Date does not type as Public are not counted.
- Nager.Date lists some days as Public that many employers treat differently, for example Christmas Eve, Midsummer Eve and New Year's Eve in Sweden. Ledigt follows the feed.
- Regional filters work at the level of states, regions and nations as Nager.Date reports them.
Calendar export and privacy
All calculations run in your browser. The .ics file is generated locally as all-day events following RFC 5545, with the end date exclusive as the standard requires. Nothing about your plan is sent to a server.
Tests
The search, the plan and the calendar export are covered by unit tests. Each test names the official calendar it is checked against, such as the Swedish act on public holidays, GOV.UK bank holidays or 5 U.S.C. § 6103, and the Nager.Date feed.