Files
it-know-how/typescript/bits/20-alignedstarts-concept.md
2026-03-27 12:58:01 +01:00

650 B
Executable File

Understanding alignedStarts

alignedStarts is an array of date boundaries that match your backend schedule rule.

Concept

const alignedStarts: Date[] = [];

Each item is a valid period boundary (for example Monday 00:00 in backend-local schedule terms).

Later, you form intervals by pairing adjacent items:

const start = alignedStarts[index];
const end = alignedStarts[index + 1];

So if alignedStarts has N items, you can make up to N-1 intervals.

Why this is useful

  • Keeps schedule boundaries consistent.
  • Makes interval generation deterministic.
  • Handles DST-safe boundaries when generated correctly.