Show HN: Stretch My Time Off – An Algorithm to Optimize Your Vacation Days (stretchmytimeoff.com)

358 points by zachd ↗ HN
Hey HN! I built StretchMyTimeOff as a quick experiment using Cursor (Anysphere's AI code editor) and GPT-4o to see how far AI could go in building a simple, functional site.

What it does: The site helps you get the most out of your vacation by suggesting optimal days to take off around national holidays, maximizing long breaks with minimal vacation days, anywhere in the world and for any calendar year.

It's an idea I've had for a while, and building the algorithm with GPT was a fun challenge. Any feedback or ideas I'm all ears :)

176 comments

[ 3.0 ms ] story [ 237 ms ] thread
This is a great idea for something I typically do manually to plan around maximizing vacation time around when my kids have off.

Would recommend being able to adjust the public holidays - for example: Juneteenth and Veterans day off were not days off of school+work.

Other future improvements would be some kind of tie in for airfare - these are typically some of the most expensive times to fly.

Love the idea

Also it would be great to be able to add "corporate" holidays, where the whole company is off because of X reason.
Thanks! Adding customisable fixed holiday days could be a nice idea :)
I think it could be as simple as clicking a date will cycle it from default, mandatory off, mandatory non-off (must be working).
Thanks a lot, now there's a quick feature to toggle off certain holidays, I see most US don't get Veteran's day indeed. It should work now, per state as well
If you add the ability to toggle days in various states this could be a really useful tool for me. Unfortunately I have family obligations that occur at various times in the year. Clickable cells that would change them from day/off or not could really help here.
Thanks! ChatGPT and I made the change for per-state support and to hide individual holidays each year :)
Most companies don't take all public holidays; this ends up being primarily for Federal workers who do get each of those holidays.

If you make a table of holidays and then check on/off those applicable, then have the algorithm fill back in as needed, that would be helpful.

Thanks for the feedback! ChatGPT and I made the change to hide individual holidays for a country per year, click "edit list" :)
Awesome idea, some suggestions (to fit my use case)

My annual leave resets on April 1st, so being able to change the year would be handy.

I worked compressed hours (I have every Friday off)

I can carry over 5 unused days to the next year, and buy 5 more days. This might impact what days I take off.

Thanks! I made options to change the year and leave balance, but not to change the first day of the year. Let me know if it still works if you enter the right number of days
Cool project!

Some regional feedback coming from Sweden - your source data set is not 100% in line with what most workers in Sweden will get. For example, 24 December, 31 December and Midsummer's Eve are not reflected as days off in this calendar.

Ah shame, I totally depend on the well maintained npm package date-holidays. But I guess it could use a PR! https://github.com/commenthol/date-holidays/blob/master/data...
I have a similar home-cooked tool at https://semestra.limbe.ro but ended up using Nager.Date instead, and it has better coverage for Sweden at least: https://date.nager.at/Api I liked the online-first approach since it means you get new or moved holidays without a package bump. The downside is of course if you want an offline-first approach.
This seems like the start of something handy, but isn't yet useful. As others have mentioned, which holidays a company offers will vary. But more than that, given a number of days off and a calendar year, this currently seems to output only 1 result, though of course there are a large number of ties (in terms of consecutive days not worked). The current tool doesn't allow the user to 'edit' or swap between 'equally good' allocations. In my attempt, it produced a very skewed result, using the vast majority of days between November and February, and using zero days in July through October. If it suggests using 4 days to extend a holiday into 9 consecutive days, there's no way to express that you'd rather do that for Labor Day than for Veterans day. If it's extending a 3-day weekend into a 4-day one, you can't indicate that you'd rather do that with Columbus Day than with Presidents Day.
Thanks for your feedback! Indeed the algorithm only gives one result, as it tries to fill all gaps from smallest to biggest in the best way possible to create clusters.

Making it super customisable would be tough, as then it becomes just a personal calendar. Maybe showing the rankings transparently (3 options tied, choose which one wins) could be nice.

Even a simple weighting might work… “do you prefer your time off to be near major public holidays?” Or “which season do you prefer to travel?” Then with the 4 day weeks accordingly. The results it gave me skipped over a lot of other federal holidays and seemed to focus all time off at years end, when I definitely do not want to travel. Which really it just needs to look for weeks with a single day off to buddy up with.
I think a simple feature that would actually effectively enable what they wanted would be to let the user manually add days which should be included in the PTO

Like maybe make the days clickable and give us a popover button for : it'd like this day to be free - and just tread this day as a holiday from there (while deducting the day from the quota)

Hi Zachd, I like this, but I'd like to be able to do it for custom date ranges, and add custom constraints.

for example, my company has mandatory shutdown days, I have x additional days leave, and z study days leave that I expected to not use more than 1 study day in the same week and I need to use some of my leave by 30 jun as australia businesses manage the financial year as july to june, not jan to december.

Like others have mentioned, being able to toggle which days are holidays would make this useful.

I get (8) holidays each year: New Year’s Day, Memorial Day, July 4th, Labor Day, Thanksgiving, Black Friday, Christmas Eve, and Christmas Day.

Two of my company holidays aren’t federal holidays, so being able to toggle arbitrary weekdays as holidays would also be useful.

Also, sometimes holidays fall on the weekend and the observed holiday date is arbitrarily chosen.

Your algorithm did pick the same vacation days as I did this year for December, so it does seem to be working properly in that sense :)

Thanks for sharing! The option to toggle holidays on/off should be working. Being able to arbitrarily add a chosen day isn't there, you just need to +1 to your days off count and let the algorithm choose for you.
Something is strange in the math for "Let's stretch your time off from X days to Y days"

I am in the US, and it says I have 11 days off. If I say I get 0 days off, it says: "Let's stretch your time off from 0 days to 18 days". It looks like it's counting the weekends prior to a holiday no matter what as a "bonus" day, which is a strange methodology to me. (I would expect that it would only count days that it performed some action to optimize, otherwise it's just table stakes)

Thanks, the count could indeed be improved. I left it as counting all clusters > 2 days as valid extra time off, so all 3 day weekends made from national holidays would be included. But of course it's over optimistic :)
I would almost rather know how many 'blocks'I got off. Like, tell me how many 1 week chunks I get, how many 2 week chunks I get, etc.
The tool is great, I would definitely use it couple of times a year to see the "pattern" :) The design is great!

Adding to the comment on "calculations". Perhaps the wording could be improved, now it feels a bit like a dark pattern in sales.

This is not the best version, but explains what I mean:

"Let's turn your X days of time off into Y days of holidays."

Very cool! It would be helpful if you just made a list of holidays we could check off. Im going to use this!
Thanks so much! ChatGPT and I just added a quick feature to hide certain holidays from a particular year, stored in LocalStorage. Let me know if it works like you expect :)
Would be nice if I could add my own holidays instead of only remove them
I have a planned trip to work around. I want to make sure those are booked, and allocate the rest optimally. I suppose this is the same problem as having extra days to allocate.
This is pretty cool. I've organically done something similar for many years (i.e. tried to optimize leave to coincide with public holidays to get those extra long weekends.)

If you think it would be fun, maybe you could expose different algorithm choices for how to allocate the blocks?

Eg, I don't necessarily need to maximize the block lengths, but would like the holidays to be more evenly spread through the year. At the moment, it gives me a huge block around the easter period and another one week block later in the same month. And then, there are no holidays for an entire six months from the end of May to the start of November, despite several public holidays in between! I suggest an alternative algorithm would seek fewer one-week blocks and more long-weekend blocks, with some sort of pressure which penalizes blocks for being too close together?

I typically try to take annual leave and to travel exactly on the opposite dates to what this tool recommends. That's because I care more about avoiding the significant extra expense, traffic, and crowds of travel over public holiday periods, than I do about getting a few extra "free days" of leave. No free lunch!
Good luck traveling on work days!
This is a real worry? Don't you just not go to meetings but otherwise solemnly swear that you're working on the plane?
It's fine as long as you avoid the very specific times people commute at, and/or are heading to a place where there aren't so many 9-5 jobs, like a beach town.
Ummm... driving out of my metro area, in any direction, on a work day: zero traffic! Doing so at the start of a long weekend / during Xmas - New Year: horrendous traffic! Is that not the case for you?
I love doing vacations that start/end midweek. It’s nice to buffer either end of the trip with short work weeks, midweek travel can be less frantic, and being able to spend weekend days at your vacation destination often lets you do more fun things rather than being there on weekdays
Surprised this passive agressive comment is not further downvoted. Doesn't add to the conversation.

Anyway, OP has a point. I hate traveling on the same day everyone else plans to due to some holiday gap / bridge / whatever.

same here, flight prices are through the roof on those days.

also on the plus side, lot of colleges takes leave in December. so, workloads on that time are also less. it's like a mini vacation if one WFH during that period.

Works great with an evening flight, you can work all day and leave for the airport after work.
GRINDSET 24/7/365 - every day is a work day but it is never rush-hour.
Strange comment. Isn't travel on work days better? People are at work, so plane and train tickets seem to be cheaper on those days because there's less demand.
Yes, I traveled recently and flights were about 20% cheaper if it was Thursday-Monday than if any Friday, Saturday, or Sunday was included. Even given the extra nights of hotel I overall saved money on the trip because I extended it.
Depending on the city it can be just fine, if not quieter to travel on a weekday.
I take time off in the winter because it’s a dreadful time to be in Berlin, while the summers are sacred and shouldn’t be spent anywhere else.
Looks like it doesn't handle year transitions nicely?

In NSW Australia, it shows 11 days between Dec 21 and Dec 31, but Jan 1 is a public holiday here and you capsule add Jan2&3 plus the following weekend to get 16 days 21 Dec 2024 through 5 Jan 2025.

Ha, this reminds me of a very similar practice I used to engage in with a few buddies when we started work. It was always fun to try to figure out how to optimize the PTO to get the “most days per day”.

Nowadays, I find that the best time to take PTO is when I feel like taking PTO. Taking a long weekend when I’m feeling burnt out or disengaged goes much further for me than grinding for the entire first half of th year to get a week off for 4th of July. YMMV.

Depending on your role and environment, certain days are also have more value in my eyes than others. For example, people tend not to push heavy stressful and potentially disaster risk processes on Fridays. They either do these on weird off hours for their target user base at large scales or Mondays in general. Fridays where I’m at tend to be “easier” days people intentionally try to make so for a gentle transition into the weekend.

As such, taking off Fridays tends to get me less ROI while Mondays tends to be nice because while everyone deals with problems from the last week head on, I can roll in on a Tuesday with the benefit of their insights and progress. Then there’s the fact even if I’m off on Friday people I socialize with are likely still working anyways so… it could be any day for myself.

This is key - taking the week between Christmas and New Year's often maximizes PTO days, but everyone does that so that week is quiet, simple, and you can put your head down and get some real work done.
I wish I could do that but I have little kids. But we have generous PTO that expires at the end of the year, so everyone takes off lots of time in December... even by December 1 things are getting quiet.
Agreed, in Switzerland this idea of "stretching" is common but I find it stupid. Weather going to be bad? Doesnt matter, I can stretch my total time off 3 days more!!! Total off season to where I am traveling to? Doesnt matter, I get that single extra "bridge" day! Man so cringe.

I don't know, seems much easier that if you dont want to work then don't!

I mean the tool OP posted recommended 2 weeks off at the end of March into April on the easter holiday (because of the friday and monday holiday)... who is honestly doing that?

This topic has always rubbed me the wrong way I think because its way too closely tied to the whole workaday / "work sucks" / ratrace / 9-5 mentality.

One other thing as I continue my rant, related, the whole "plan your holidays for the next year so we can figure out the resource planning, even if you move your holiday!" Ugh so depressing, I always am like "welp next year is planned already and its only November". Nothing spontaneous, nothing interesting.

Anyway, I realize also I am likely in the minority here, HN folks will do anything for a "hack".

>>I mean the tool OP posted recommended 2 weeks off at the end of March into April on the easter holiday (because of the friday and monday holiday)... who is honestly doing that?

sad parents tied to school holidays noises.

Sorry, I don't understand - why wouldn't you do that?
Parent (heh) means they have no choice but to plan their holidays during the days off in the school roster. Tools like these are pretty much pointless if you can take a day off from work, but your kid is required to show up in school.
When I had younger children, we would just pull them from school on occasion. This did require a bit coordinating with homework, teachers etc, but they don't have to be in school. On a more serious note, schools are there to serve you, be assertive about your children being yours, they do not belong to the state (at least in the USA).
Yeah, that doesn't work in a lot of countries. I can be assertive all I want, but if I pull my child out of school without permission, I risk getting a call from the local child protection services and/or getting fined.
_Whose_ permission is needed? You're their parent , that's all the "permissions" needed.
In the Netherlands (and other countries), you have something called "leerplicht" or obligatory education law, and have to ask the school for permission.

The school is allowed to make an exemption for a maximum of 10 days, above that you need to contact the school attendance officer. This can only be provided if the reason falls under some specific types.

If you want to take your children on a holiday outside the national holidays, you have to provide proof that this only a possibility during term time.

You can read more about this at https://www.government.nl/topics/compulsory-school-attendanc...

It's the same in Germany, plus home schooling is not permitted (except in some very specific circumstances).
School isn't optional in a lot of European countries. Parents don't get to decide that their kids don't need to attend.
I live in a country that has laws that protect the children, this includes making sure they get an education.

So now you are not free to do whatever you wish or force schools to teach the way you would like to.

And this is great.

And I also pulled my kids from school once or twice to get a better price on skiing but I am ashamed of myself.

Parents don't always know best. There are countries where the child's right to education is seen as higher than the parent's right to do what they think is right.
If kids are performing academically there isn’t much grounds for the school to stand on.
If I am driving 200 km/h but did not have an accident there isn't much grounds for police to fine me.

Law is not optional.

I meant to be referring to pulling kids out of school randomly .. nothing to do with speeding. My comment appears to have ended up under the wrong post :)
> if you can take a day off from work, but your kid is required to show up in school.

Sounds like a real day off, though. ;)

If I could go on a 4-day week, I think I would choose Wednesday, drop the kids off at school, head to the mountains for a hike or skiing in winter, and pick them back up in the afternoon. Now, that would be the perfect work week :)
This sounds like a feature request / opportunity.

Like, can the tool be expanded to do:

1) Finding vacation time for a group of people (family? college friends?)

2) Can you include black-out days (school days for kids, whatever your specific job requires, etc)

I mean, as long as _I'm_ not responsible for making this thing I can make feature suggestions all day :)

> 2 weeks off at the end of March into April on the easter holiday (because of the friday and monday holiday)... who is honestly doing that?

It's like peak cross country season?! Still loads of snow, but nice weather. I skied in shorts and a tshirt for days this easter!

You know you don't have to do as the tool says? It just highlights one of many variables you can use when deciding when to take your time off. If you have other needs (as your weather thingy, or spontaneity, or when kids are off school), you are of course free to take that into account.

> plan your holidays for the next year

i am absolutely lost in why anyone would do that. And on other side, resource planning is only lame excuse.

But AFAIK most of western europe goes that way.. which is a preliminary planned existance. Boring like hell. Where is Life?

As soon as you have kids in the age range where school is mandatory you are pretty much confined to the school holiday roster for big trips. This means you pretty much have to get your planning going soon, if you want trips that are both interesting and possible.

Planning ahead is the only way to actually have some freedom. You can rent really nice cottages, get that night train reservation, etc., as long as you plan ahead.

I'd love it if it were possible to have elective days off for kids in school as well, but that's usually only possible for people in certain jobs who can't use the regular school holidays.

I thought it was a bit much too until I learned that there can be benefits from a life management perspective to setup yearly traditions, as well as often being able to get beer value for some things planned out in advance
When I was in my early 20s I had a few friends who were obsessed with traveling and would do stuff like this to maximize long blocks of time off, then they'd pick where to go because now they have 9 days instead of 4, and decide where to go backed on what time of year they had that longer block.

If your trying to maximize "contiguous days off" and you truly don't care when it is, a tool like this is super helpful.

This is a great way to plan a travel window and even pick the best destination that presents itself then.
Most days per day also probably means that you're maximizing the amount you spend on travel and the pain you experience. It's not cheap or pleasant traveling around July 4th.
It's important to take off a day when you're feeling burnt out, but for some, I think it's also important to plan ahead a little bit to see the "most days per day" where you, your kids, your partner, etc. will all have off together.
Exactly! I will throw a day off a few weeks away so that I have something to look forward to. When it actually arrives sometimes I don't even care anymore, but it is a great morale booster in the moment. A few three day weekend can be so much more impactful than having 9 days off instead of 5ish.

Looking at the calendar and seeing the next holiday is 6+ weeks away can really drag you down.

Great work. Coincidentally, I am working on similar tool built using Sveltekit and posted about it on HN today as well :-)
As others have said, I would love to see more variations to show “options” on ties, and also have more customization around holidays. Not just show/hide but adding and removing custom dates would be great!
For us that are parents, an option to load in spring break, summer break, etc. would be helpful.
Very nice. All the holidays look correct.

Covers most of the tricks people here (New Zealand) use to stretch out their Holiday lengths.

It should span over the New Year:

Dec 21 to Dec 31: 11 days is actually Dec 21 to Jan 1: 12 days and still only 5 vacation days.

Cool, based on geolocation it gets the vacation days for your country.
My employer sets aside a few extra holidays to bridge holidays to the weekend. For example this year July 4th was on Thursday so they gave the Friday off too. They also give Winter holidays from 24th to the 1st so its aligned right, a few more vacation days and it adds up to two weeks. And usually the day before long holidays teams tend to work half day so sometimes you don't even need to take a day off.
Interesting idea but I do not see the point: people are able to compute the same results mentally very easily.

By the way, I would suggest adding an option: how many consecutive days off does the company allow. And which days are absolutely not allowed to be taken.

10 years ago, in my company (based in Japan), taking a day off on the first day of the week (generally Monday unless there's an holiday) was not allowed due to the general meeting kicking off the week. This changed recently in my company but as this meeting is common in many Japanese companies, some companies might still apply this restriction.

Likewise, taking a day off before or after a holiday was not allowed except for some specific days (typically Golden Week end of April/beginning of May, Obon in August, and the end of year/New Year). This changed a few years ago.

Great tool and excellent design . I’ve always wanted something like this.