Skip to content
Nell Ashdown

Craft

What a calendar should do with a Sunday

Booking rules are easy to write and hard to show. Three patterns from eight cabins in the reeds.

A black timber cabin on a misty creek among reeds, with a rowing boat at its jetty.

Hanneke’s cabins can’t be rented from a Sunday in July. They can in March. If you stay four nights in October you may arrive on a Sunday, unless the pair of cabins at the end is taken.

That is one rule out of eleven. None of them are strange. Every small rental I know has a list like this, and it lives in one person’s head.

Write the rules as sentences

Before any code, I wrote all eleven as plain sentences and read them aloud to her. Two were wrong, and one she had forgotten herself. The sentences are still in the code, above the functions that carry them out.

rules.ts
// In July and August, stays start on Friday or Monday.
const summerArrival: Rule = (stay) =>
  !isSummer(stay.from) || ["fri", "mon"].includes(weekday(stay.from))

Never offer what you will refuse

Grey days with no explanation feel broken. So the calendar works backwards: it takes your guests and your number of nights, and shows only the days you can arrive. You can’t pick a wrong one.

Turn a no into an offer

When a stay is one night too short, the old tool said “minimum stay not met”. The new one says: three nights minimum, the third is half price. One in four people takes it.

A calendar is a conversation about time. The good ones are polite.

SlipcaseIn UI Pro, from €199 onceGet this theme