high-precision, polymorphic library for the Coptic liturgical calendar, featuring advanced date arithmetic and a modular plugin system for the Synaxarium, liturgical feasts, and canonical rites.
- Universal Polymorphism: Convert from native
Date, ISO strings, timestamps, elements, or custom Temporal-like objects. - Fluent Arithmetic: Perform elegant date manipulations with
add,subtract, andwith. - Localization: Full translation support for English, Arabic, and Coptic (Bohairic).
- Extensible Architecture: Modular plugin system allows lightweight core or full liturgical immersion.
- TypeScript Native: Zero-dependency, ESM-first library with strict type safety.
npm install coptic-calendarimport { CopticDate } from 'coptic-calendar';
// Polymorphic .from() supports Dates, strings, timestamps, and elements
const date = CopticDate.from({ year: 1740, month: 5, day: 23 });
// Access calendar components
console.log(`Coptic Date: ${date.year}-${date.month}-${date.day}`); // "1740-5-23"
console.log(`Is Leap Year: ${date.inLeapYear}`); // false
// Multi-language localization support
console.log(date.toLocaleString({ locale: 'en' })); // "23 Tobi 1740"
console.log(date.toLocaleString({ locale: 'ar' })); // "٢٣ طوبة ١٧٤٠"const start = CopticDate.from('2024-01-01'); // 22 Kiahk 1740
// Addition and Subtraction
const nextMonth = start.add({ months: 1 }); // 22 Tobi 1740
const lastYear = start.subtract({ years: 1 }); // 22 Kiahk 1739
// Fluent modification
const specificDay = start.with({ day: 15 }); // 15 Kiahk 1740
// Comparison
if (start.equals(nextMonth)) { /* ... */ } // false
const order = CopticDate.compare(start, nextMonth); // -1 (start < nextMonth)The library is lightweight by default, but can be extended with specialized plugins for ecclesiastical data.
Provides daily saint commemorations and historical readings.
import { CopticDate } from 'coptic-calendar';
import { synaxariumPlugin } from 'coptic-calendar/plugins/synaxarium';
CopticDate.extend(synaxariumPlugin);
const date = CopticDate.from('2024-04-19'); // 12 Paremoude 1740
console.log(date.synaxarium({ locale: 'en' }));
// ["The Departure of St. Alexander, Bishop of Jerusalem.", ...]Calculates all liturgical feasts and fasts, including the moving Paschal cycle.
import { CopticDate } from 'coptic-calendar';
import { occasionsPlugin } from 'coptic-calendar/plugins/occasions';
CopticDate.extend(occasionsPlugin);
const date = CopticDate.from('2024-04-19');
console.log(date.occasions({ locale: 'en' })); // ["Great Lent"]
// Find specific occasions
const easter = date.when('Easter');
console.log(`Easter is on: ${easter.toString()}`); // "1740-8-27"Derives the active canonical Typicon configuration (season, tune, etc.) for any date.
import { CopticDate } from 'coptic-calendar';
import { typiconPlugin } from 'coptic-calendar/plugins/typicon';
CopticDate.extend(typiconPlugin);
const date = CopticDate.from('2024-04-19');
const rite = date.rite({ locale: 'en' });
console.log(`Season: ${rite.season}`); // "Great Lent"
console.log(`Tune: ${rite.tune}`); // "Lenten"
console.log(`Metanoias: ${rite.hasMetanoias}`); // trueWe welcome contributions! Please follow these steps:
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under The Unlicense - see the LICENSE file for details.
