{
  "id": 4947991,
  "title": "Bitmask Calendars: How I Built Fast, Timezone-Safe Slot Availability in Flutter",
  "url": "https://urgent.news/2026/09/01/bitmask-calendars-how-i-built-fast-timezone-safe-slot-availability-in",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-09-01T21:44:00.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/mostafijur_rahman_d122743/bitmask-calendars-how-i-built-fast-timezone-safe-slot-availability-in-flutter-e7e"
  },
  "original_language": "en",
  "account": "Bitmask calendars provide fast, timezone-safe slot availability in Flutter applications. The author explains how they implemented this feature in their Drivers Lesson app. Instead of using a list of booleans for each 30-minute time slot, they represented a day's availability as a single integer bitmask. Each bit in the bitmask corresponds to a specific time slot, with a set bit indicating that the slot is available. This approach allows for efficient bitwise arithmetic operations when computing, filtering, and updating availability.\n\nTo handle recurring availability for instructors, extra sessions, and existing bookings, the author combines the relevant data sources using bitwise operations. They first merge the availability masks of all sources, then remove any slots that are already booked or blocked by a day off. This process simplifies the logic required to determine if a specific time slot is available for booking.\n\nThe author emphasizes the importance of handling timezone differences correctly. Every slot is generated, stored, and compared as UTC internally, while the UI displays the local time only for presentation purposes. This ensures that there are no discrepancies caused by different timezones when checking slot availability or deduplicating overlapping slots.\n\nWhen a student confirms a slot for booking, the app triggers a Stripe payment with 3D Secure verification. The payment process is treated as a dependency on the availability, ensuring that the payment is only processed if the slot remains available at the time of booking. This sequential dependency prevents stale UI data from causing payment errors.\n\nThe author concludes by recommending that teams building similar features should model availability as a small, composable data structure before resorting to per-slot booleans. They also stress the importance of performing all comparisons in UTC and converting to local time only for display purposes. Finally, they suggest checking the slot's bookability right before payment, rather than relying on cached values from when the booking sheet was opened.",
  "summary": "Drivers Lesson lets a student pick a driving instructor, see which time slots are actually free, book one, and pay for it — with 3DS card verification in the loop. The booking screen looks simple: a calendar, a list of times, a confirm button. Almost none of the actual difficulty is in that UI. It's in deciding, correctly and quickly, which slots to show in the first place. Three things made this…",
  "key_points": [
    "Bitmask calendars enable fast, timezone-safe slot availability in Flutter apps.",
    "Author implemented bitmask representation for 30-minute time slots using single integer.",
    "Handling timezone differences by storing and comparing slots as UTC internally."
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}