function normalizeDurationDays
normalizeDurationDays(value: number): number

The single definition of "a valid booking duration": a whole number of days in [1, MAX_DURATION_DAYS], with non-finite input degrading to 1.

Every read of duration_days and every durationDays parameter funnels through here so the clamping policy lives in exactly one place — the column write, the per-day capacity expansion (JS + SQL), and all display paths agree by construction. Idempotent, so applying it to an already-normalized value (e.g. a column-clamped event.duration_days) is a safe no-op.

Parameters

value: number

Return Type

number

Usage

import { normalizeDurationDays } from "doc.ts";