School Schedule Engine

System LogicVerifiedShare on

The pure restriction function.

HM Redowan1 min readUpdated 2026-12-04

Bu sayfanın Türkçe çevirisi editör incelemesinde. İngilizce sürüm gösteriliyor.

ts
computeRestriction({ now, isBoarding, schedules, holidays, unlocks })
// → { restricted, reason: "schedule" | "holiday" | "unlock" | "free", schedule? }
  1. Convert now to Europe/Istanbul date, minutes and ISO weekday.
  2. Find the first schedule that is active, in scope, lists today, and start <= now < end.
  3. None → free.
  4. Holiday today and scope all → holiday.
  5. Approved unlock with starts_at <= now < ends_at → unlock.
  6. Else → schedule (restricted).
Bu sayfa yardımcı oldu mu?