diff options
| author | Bobby <[email protected]> | 2026-04-22 06:48:46 +0530 |
|---|---|---|
| committer | Bobby <[email protected]> | 2026-04-22 06:48:46 +0530 |
| commit | 4383213a23e27903e1fed270f1dbcc116644c7fc (patch) | |
| tree | c5920b6ca2d7faf7f41e29694c7a54956f213c07 /tests/unit/utils/assert.test.ts | |
| parent | 47381ca2cd6dec22848b66924d9558a191e47218 (diff) | |
| download | hollowdark-4383213a23e27903e1fed270f1dbcc116644c7fc.tar.xz hollowdark-4383213a23e27903e1fed270f1dbcc116644c7fc.zip | |
Implement GameTime and the 12-month calendar
The Hollowdark calendar is 12 × 30-day months + a 5-day year-end
festival = 365 days, with 7-day weeks (docs/01-world.md and the
style bible). Months live in canonical order:
spring 1 Thawing 2 Greening 3 Blossomtide
summer 4 Highsun 5 Amberhaze 6 Harvestmark
autumn 7 Firstfall 8 Stormturn 9 Ashfall
winter 10 Rainfall 11 Hollowdark 12 Rimefrost
festival 13 Year's End Festival (5 days)
time/calendar.ts month names, season mapping, days-per-month,
festival helpers
time/gameTime.ts GameTime shape + arithmetic: makeGameTime,
addDays / addWeeks / addMonths / addYears,
daysBetween / weeksBetween, compare / isBefore /
isAfter / isSameDay, dayOfWeek, dayOfYear,
toAbsoluteDays, formatGameTime
time/granularity.ts LifeStage + TickUnit mapping — one tick is a
year in infancy, a season in childhood, a month
in adolescence and old age, a week in adult life
(docs/05-time-system.md, ARCHITECTURE.md §5)
time/speed.ts Speed type: 'paused' | 'play' | 'fast'
time/index.ts public re-exports
Arithmetic is implemented by flattening GameTime to absolute-day
integers (year × 365 + dayOfYear - 1) so addDays, daysBetween, and
ordering are exact integer math. addMonths uses 13-month modular
arithmetic and clamps the day into the festival's 5-day length on
overflow.
59 unit tests in tests/unit/time/ cover constants, validation,
arithmetic edge cases (Rimefrost 30 → Festival 1, Festival 5 →
Thawing 1 of next year, day-clamping when landing in the festival),
negative offsets, tickOfDay preservation, day-of-week stability,
and life-stage boundaries.
Diffstat (limited to 'tests/unit/utils/assert.test.ts')
0 files changed, 0 insertions, 0 deletions
