32 ms·
So, if I want to book the night from Jan 13th to Jan 14th on AirBNB (which is the very first example given in the post), I should search for "Arrival Jan13th, D
by Rygian 4y ago
So, if I want to book the night from Jan 13th to Jan 14th on AirBNB (which is the very first example given in the post), I should search for "Arrival Jan13th, Departure Jan 13th"?
As with any piece of advice, there are cases where it applies and cases where it does not apply. Or, in other words, someone can claim "Well, of course!" for the opposite advice.
- deleted 4y ago[deleted]
- sshine 4y agoNo, a [closed, open) interval of [Jan 13, Jan 13) would give you 0 nights. A [closed, open) interval of calendar dates incidentally does correspond to the number of nights spent. So booking [Jan 13, Jan 14) would mean spending one night. The hotel gives you until, say, 11:00 to get out the next day without paying for that date. Half-open intervals are neat because they concatenate without overlap. So [Jan 13, Jan 14) + [Jan 14, Jan 15) = [Jan 13, Jan 15). This is a very convenient property when dealing with dates in particular, but also indices over arrays.
- Rygian 4y agoSo it boils down to what is being represented: an amount of items versus an amount of _boundaries_ across items. When I'm booking that stay between Jan 13th and Jan 14th, and I am presented with options, the ones that say "sleeps 2" does not mean [1, 2) but rather [1, 2] and the one that says "sleeps 6" does not mean [1, 6) but rather [1, 6].
- jissa 4y agoBut I don't think these are equivalent. When looking for a booking you are using an interval. When looking at room capacity you are looking for a minimum. This is not the same as an interval. If you are looking for "sleeps 6" that is your bare minimum acceptance in capacity. You are not interested for the [1, 6] interval. Nothing below 6 makes sense. Even if you wanted to force the interval use here, I'd say you'd be looking for the [6, INF) interval. That is, rooms with capacity of at least 6 (but having more capacity is fine).
- girvo 4y agoOr selecting ranges for various UI things — our customers complained that the “end” was exclusive! We had to change it
- Archelaos 4y agoI am entrusted with a database application for a tour operator. The actual use cases for start and end dates can be quite tricky. For some of them arrival and departure date are most relevant, for others it is arrival and nights (or first and last date of the evening of the night). In the latter case, think of a calendar that shows the occupancy of a room for the manager. The only reasonable way to do this is to mark the days where the room is occupied in the evening and ignore the morning. With rental cars it is even trickier, because there a 24 hour cycle form pickup time to drop off time is the basis for counting the days of rental. Some metrics are best made available to managers in two versions for convinience, e.g. trip price per person per day vs. trip price per person per night (where day = night + 1). For the business logic (except for rental cars, which use a modified one) I implemented a special general purpose Duration class with the following properties: DateOfArrival DateOfDeparture DateFirst /* same as DateOfArrival */ DateLast /* day before DateOfDeparture */ Nights Days /* Nights plus 1 */ The class comes with some operations for combining Durations or calculate/check-for intersections, etc. With this class, it is easy to switch between an open and a closed interval view of the same data, and it is very transparent in the source code which is actually used.