.cursor/skills/calendar-patterns/SKILL.md
Catalogs common implementation patterns used by existing calendars and timekeeping systems in the Library of Time, with examples and guidance on when to use each pattern. Use when choosing how to structure a new calendar’s algorithm.
npx skillsauth add CodapopKSP/LibraryOfTime calendar-patternsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use this skill when:
This skill complements:
calendar-math – overall workflow and placement.calendar-conventions – epochs, timezones, and helpers like createAdjustedDateTime.| Pattern | Core idea | Typical use |
| --- | --- | --- |
| Anchor-epoch + day count | Fixed epoch in local time; use differenceInDays to derive years/months/days. | Straightforward civil calendars with fixed-length months/cycles. |
| Equinox/solstice-anchored year | Year boundaries defined by solstice/equinox events (often with sunset/noon rules). | Calendars whose year starts on solar events (Baháʼí, Solar Hijri, French Republican). |
| Shifted day-boundary | Day changes at sunset/sunrise or other local time, weekday computed separately. | Religious or historical calendars where day starts before/after midnight. |
| Timezone-localized Gregorian | Use createFauxUTCDate and format directly. | Localized Gregorian derivatives (Minguo, Juche, Thai, ISO week, SCA). |
| JDN-based conversions | Convert Gregorian ↔ Julian (or similar) via JDN. | Calendars that are essentially Julian-based or need robust pre‑1582 behavior. |
| Cycle-based / exotic year models | Years with variable length and custom month-day tables. | Planetary calendars (Darian, Galilean, Titan), complex cycles. |
Core idea
createAdjustedDateTime.daysSinceEpoch = floor(differenceInDays(currentDateTime, epoch)).daysSinceEpoch against arrays of month lengths and leap-year rules.Examples
getCopticDate (solarCalendars.js)getEthiopianDate (solarCalendars.js)getEgyptianDate (solarCalendars.js)getCurrentMayaLongCount, getHaabDate, getTzolkinDate, getLordOfTheNight (otherCalendars.js)When to use
Key ingredients
createAdjustedDateTime({ timezone: 'UTC±HH:MM', year, month, day })differenceInDays(currentDateTime, epoch)isLeapYear(year).Core idea
getSolsticeEquinox.createAdjustedDateTime + addDay.differenceInDays(currentDateTime, startOfYear) to locate the day-of-year, then map into months/days.Examples
getBahaiCalendar (solarCalendars.js)getSolarHijriDate (solarCalendars.js)getRepublicanCalendar (solarCalendars.js)When to use
Key ingredients
getSolsticeEquinox(currentDateTime, 'SPRING' | 'AUTUMN' | ...).differenceInDays(endingEquinox, startingEquinox).Core idea
getWeekdayAtTime.Examples
getCopticDate uses day count from epoch + getWeekdayAtTime(..., { hour: 22 }).getEthiopianDate uses epoch + getWeekdayAtTime(..., { hour: 21 }).getWeekdayAtTime(..., { hour: 'SUNSET' }, 'UTC+03:30').getWeekdayAtTime(..., { hour: 20, minute: 30 }).getWeekdayAtTime(..., { hour: 'SUNRISE' }, 'UTC+03:30').calculateHebrewCalendar in lunisolarCalendars.js).When to use
Key ingredients
getWeekdayAtTime(currentDateTime, { hour, minute | 'SUNSET' | 'SUNRISE' }, timezone?)differenceInDays logic for day counts.Core idea
Date.createFauxUTCDate(currentDateTime, timezoneOffset) to get a “local” view.Examples
getMinguo, getJuche, getThaiSolar (solarCalendars.js).getGregorianDateTime (solarCalendars.js).getAnnoLucisDate (solarCalendars.js).getDiscordianDate, getPataphysicalDate, getISOWeekDate (solarCalendars.js).getSocietyForCreativeAnachronismDate (solarCalendars.js).When to use
Key ingredients
createFauxUTCDate(currentDateTime, 'UTC±HH:MM' or numeric offset)getGregorianDateTime as a base for many derivatives.Core idea
gregorianToJDN).JDNToJulianDate or similar).Examples
getJulianCalendar (solarCalendars.js).getAstronomicalDate (solarCalendars.js) for pre‑1582.When to use
Key ingredients
gregorianToJDN(currentDateTime)JDNToJulianDate(JDN)Core idea
daysSince from an epoch, or use Julian Sol Number.getDaysInYear(year).Examples
getDarianMarsDate(julianSolNumber) (otherCalendars.js).getGalileanDate, getDarianGalileanDate (otherCalendars.js).getDarianTitanDate (otherCalendars.js).getIcelandicDate (solarCalendars.js).getPawukonCalendarDate (otherCalendars.js).When to use
Key ingredients
createAdjustedDateTime({ ... }) or a precomputed sol number.differenceInDays / custom “day” size (for non-Earth days).isLeapYear variations and arrays of month lengths per body/system.Use this table as a quick guide:
| System characteristics | Recommended pattern(s) | | --- | --- | | Simple civil calendar with fixed months and known epoch | Anchor-epoch + day count | | Year begins at solstice/equinox; length varies year to year | Equinox/solstice-anchored year (+ possibly shifted day-boundary) | | Day starts at sunrise/sunset; weekday must respect that | Shifted day-boundary / weekday logic (Pattern 3) layered on top of 1 or 2 | | Gregorian-derived with new era or labels | Timezone-localized Gregorian derivatives (Pattern 4) | | Calendar historically tied to Julian/Gregorian math | JDN-based conversions (Pattern 5) | | Non-Earth or very unusual leap rules | Cycle-based / exotic year models (Pattern 6) |
When in doubt:
development
Compute weekdays correctly for calendars where some days (intercalary/epagomenal) are excluded from the weekday cycle. Use when implementing or debugging weekday logic with “skipped days”, “epagomenal”, “intercalary”, or “non-weekday” days.
tools
Use user-provided month names or labels in calendar implementations and output. Use when implementing or updating a calendar and the user has given a list of month names (including for leap months), so the implementation does not default to numeric-only output.
development
Designs and implements complete calendar and timekeeping calculation modules for the Library of Time project, including algorithms, date conversions, and tests. Use when working on calendar logic, adding a new calendar, or one-shotting an entire calendar implementation from a prompt. Treat `CalendarAPI/Calendars/*`, `CalendarAPI/Timekeeping/*`, and `CalendarAPI/Other/*` as a single Calendar API layer.
development
Encodes conventions and logic patterns for building calendars and timekeeping systems in the Library of Time project, including preferred use of utilities like createAdjustedDateTime, timezone handling, and epoch selection. Use when implementing or refactoring calendar logic so behavior matches existing systems.