.cursor/skills/calendar-conventions/SKILL.md
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.
npx skillsauth add CodapopKSP/LibraryOfTime calendar-conventionsInstall 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 whenever you:
CalendarAPI/Calendars/*, CalendarAPI/Timekeeping/*, CalendarAPI/Other/*).Display and return shape vs. user intent
{ output, day, month, year, dayOfWeek, other }. Populate only what the specification or user request describes. If they did not ask for a calendar year label, keep year: null and omit a year from output (do not infer CE counts, “proleptic year numbers,” or similar unless asked).year.Year numbering and BCE
... 2 BCE, 1 BCE, 1 CE ... becomes ... -2, -1, 1 ... (year 0 sits between 1 BCE and 1 CE).-N in all code, tests, and examples.
-385, not -384.Prefer createAdjustedDateTime over raw Date construction
createAdjustedDateTime for any logic that depends on:
MIDNIGHT, SUNRISE, NOON, SUNSET.new Date(year, monthIndex, day, ...) and new Date(Date.UTC(...)) directly; they have pitfalls:
Always think in terms of an explicit epoch / anchor date
Timezone handling
UTC+02:00 and convert them with convertUTCOffsetToMinutes.Date.createAdjustedDateTime or createFauxUTCDate with the appropriate offset.Day-boundary logic
getWeekdayAtTime(currentDateTime, afterTime, timezone) with hour enums (SUNRISE, SUNSET, etc.) to compute the effective weekday index only (0–6).differenceInDays, as in the existing Coptic, Ethiopian, Baháʼí, Solar Hijri, Qadimi, and Hebrew implementations.Date arithmetic if getWeekdayAtTime already matches the intended behavior.Prefer logic inside the calendar’s main function
nodeUpdate.js: e.g. getXxxDate, getXxxCalendar). Call helpers from there; avoid scattering logic at top level.Avoid load-time dependency on other scripts
index.html. Calendar files (e.g. lunisolarCalendars.js) often load before utilities.js. Do not run code at top level that calls createAdjustedDateTime, getMoonPhase, getNewMoon, or any other API from another file — at load time those may be undefined and will throw.createAdjustedDateTime or astronomical functions. Build those inside the main function (or a helper called from it), or use lazy initialization (e.g. a getter that creates the epoch on first use, when all scripts have loaded).Summary
utilities.js or astronomicalData.js at load time.Conversion functions
toGregorian(date, options)fromGregorian(gregorianDate, options)createAdjustedDateTime and helpers like addYear, addDay, and differenceInDays for arithmetic.calendar-patterns skill.Mutability vs immutability
addYear and addDay mutate the provided Date by default.createNew=true or explicitly clone dates (e.g., new Date(date)) when you need pure functions that do not modify inputs.Weekday and label calculation
getWeekdayAtTime for calendars whose weekday changes at a non-midnight boundary.weekNames and monthNames where appropriate, instead of redefining or hardcoding labels.Leap seconds and specialized timescales
TAIleapSeconds and GPSleapSeconds arrays in utilities.js rather than duplicating leap-second data.Before finalizing a new system, verify:
createAdjustedDateTime, getMoonPhase, or other modules (avoids load-order errors).createAdjustedDateTime (or higher-level helpers that rely on it), not raw Date constructors.UTC±HH:MM strings or numeric minute offsets, not implicit environment time.getWeekdayAtTime (for weekdays) and anchor-based differenceInDays calculations (for day counts) or an equivalent helper, not ad-hoc comparisons.+days, +years) consistently uses addDay / addYear with a clear choice about mutation.utilities.js where possible.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.
development
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.
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.