init at work
This commit is contained in:
Executable
+26
@@ -0,0 +1,26 @@
|
||||
# Understanding `alignedStarts`
|
||||
|
||||
`alignedStarts` is an array of date boundaries that match your backend schedule rule.
|
||||
|
||||
## Concept
|
||||
|
||||
```ts
|
||||
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:
|
||||
|
||||
```ts
|
||||
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.
|
||||
Reference in New Issue
Block a user