Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Why would you want a half-open interval when booking an AirBnB or flight? If I search for flights from February 24 to February 24 I don’t expect the empty interval.


AirBnB bookings are actually half-open, because you book a number of nights - so if you book December 1 - 3, you book the nights of December 1 and 2 - excluding 3. This seems expected to me.

However, as an AirBnB host, this bit me once because if you set that you're available on December 1, 2 and 3, guests can actually book December 1 - 4. But this is more because availability uses individual dates (almost like closed ranges) instead of half-open ranges like bookings do.

For booking flights, though, it's more like you're booking two individual flights on specific dates, it's not really a range at all, and so it doesn't really matter whether you think of it as open or closed. The flight search engine might want to check that the second flight departs after the first flight lands, but that has more to do with the flight times than the dates you enter.


> If I search for flights from February 24 to February 24 I don’t expect the empty interval.

The expectation depends on how you define "from" and "to" :-D

Since the HN community is quite mathematically-minded, I'd expect there all four possible kinds of definitions in the inner minds of HN members. :-D


Ignoring user experience, I would argue that this is actually an implicit half-open interval. You aren't really saying "give me flights from feb 24 to feb 24", you're saying "give me flights ON feb 24", which can be rephrased as "give me flights that take off feb 24th at midnight up to but not including february 25th at midnight".


Flights are just a set of two dates, not a range, like the other comment mentions.

I thought about it and this applies to an AirBnB, or more generally, a vacations, too. A vacation from Nov 25 to Nov 27 doesn't mean you stay from Nov 25 0:00 to Nov 27 23:59:59, but it means "arrive sometime Nov 25, leave sometime Nov 27" - a set of two dates


Yeah, when talking to humans about dates, [closed, closed] is useful.

Once you swap to a higher precision format for an actual database search, you get all the messiness from the article.


> I don’t expect the empty interval.

We're squarely in the realm of preferences here. I'm the exact opposite of you: to me the last day is not included.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: