refactor: event instances

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-07-03 19:10:00 -04:00
parent acbe0ad5ca
commit 37fa7b911e
17 changed files with 498 additions and 479 deletions
+26
View File
@@ -87,6 +87,32 @@ describe('daily recurrence', () => {
expect(occurrences.map(occurrence => new Date(occurrence.startMs).getHours())).toEqual([9, 9, 9])
})
it('preserves exclusive calendar-day duration for recurring timeless events', () => {
const entity = recurringEntity({
pattern: 'absolute',
precision: 'daily',
interval: 1,
}, {}, '2026-03-07T00:00:00+00:00')
const event = entity.properties as unknown as {
endsOn: string
timeless: boolean
}
event.endsOn = '2026-03-08T00:00:00+00:00'
event.timeless = true
const occurrences = expandEntityOccurrences(
entity,
daysVisibleRange(new Date(2026, 2, 7), 3),
)
expect(occurrences).toHaveLength(3)
expect(occurrences.map(occurrence => new Date(occurrence.startMs).getHours())).toEqual([0, 0, 0])
expect(occurrences.map(occurrence => {
const end = new Date(occurrence.endMs)
return [end.getDate(), end.getHours()]
})).toEqual([[8, 0], [9, 0], [10, 0]])
})
})
describe('weekly recurrence', () => {