calendaryjs-plugin-liturgical 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,200 +1,81 @@
1
- # calendaryjs-plugin-liturgical
1
+ <p align="center">
2
+ <img src="https://cdn.jsdelivr.net/npm/calendaryjs/assets/logo.svg" alt="calendaryjs" width="380" />
3
+ </p>
2
4
 
3
- Liturgical calendar plugin for [Calendary](https://www.npmjs.com/package/calendaryjs). Adds support for Easter calculation and offset-based events.
5
+ # calendaryjs-plugin-liturgical
4
6
 
5
- ## Features
7
+ > **New to calendaryjs?** Start with the [core README](https://www.npmjs.com/package/calendaryjs) — this plugin builds on its engine.
6
8
 
7
- - **✝️ Easter Calculation** - Computus algorithm for accurate Easter dates
8
- - **📅 Offset Events** - Events relative to Easter or other base events
9
- - **⛪ Church Calendar** - Full liturgical year support
10
- - **🔧 Flexible** - Works with any Christian denomination
9
+ Adds the **Roman Catholic liturgical calendar** to calendaryjs: Easter (via the Computus
10
+ algorithm) plus the movable feasts declared as offsets from it, so the whole cycle
11
+ follows automatically each year.
11
12
 
12
- ## Installation
13
+ ## Install
13
14
 
14
15
  ```bash
15
- pnpm add calendaryjs calendaryjs-plugin-liturgical
16
+ npm i calendaryjs calendaryjs-plugin-liturgical
16
17
  ```
17
18
 
18
- ## Requirements
19
+ ## Use it
19
20
 
20
- - `calendaryjs` >= 0.1.0
21
+ Register the plugin, then declare `easter` and `offset` events — an `offset` is placed
22
+ relative to Easter (negative = before, positive = after):
21
23
 
22
- ## Quick Start
23
-
24
- ```typescript
24
+ ```ts
25
25
  import { calendary } from "calendaryjs";
26
26
  import { liturgical } from "calendaryjs-plugin-liturgical";
27
27
 
28
- const cal = calendary();
29
- cal.use(liturgical());
28
+ const cal = calendary().use(liturgical());
30
29
 
31
30
  cal.addGroup({
32
31
  id: "church",
33
- name: "Church Calendar",
34
32
  events: [
35
33
  { type: "easter", id: "easter", title: "Easter Sunday" },
36
- { type: "offset", id: "ash-wed", baseEvent: "easter", offsetDays: -46, title: "Ash Wednesday" },
37
34
  {
38
35
  type: "offset",
39
- id: "palm-sunday",
36
+ id: "ash-wednesday",
40
37
  baseEvent: "easter",
41
- offsetDays: -7,
42
- title: "Palm Sunday",
38
+ offsetDays: -46,
39
+ title: "Ash Wednesday",
43
40
  },
44
41
  {
45
42
  type: "offset",
46
- id: "good-friday",
43
+ id: "palm-sunday",
47
44
  baseEvent: "easter",
48
- offsetDays: -2,
49
- title: "Good Friday",
45
+ offsetDays: -7,
46
+ title: "Palm Sunday",
50
47
  },
51
48
  { type: "offset", id: "pentecost", baseEvent: "easter", offsetDays: 49, title: "Pentecost" },
52
49
  ],
53
50
  });
54
51
 
55
- const events = cal.getEventsInRange("2025-01-01", "2025-12-31");
56
- ```
57
-
58
- ## Event Types
59
-
60
- ### `easter`
61
-
62
- Easter Sunday, calculated using the Computus algorithm.
63
-
64
- ```typescript
65
- {
66
- type: 'easter';
67
- id: string;
68
- title?: string;
69
- // ... other standard event properties
70
- }
52
+ cal.getEventsInRange("2025-01-01", "2025-12-31");
71
53
  ```
72
54
 
73
- ### `offset`
55
+ Common feasts ship as ready-made presets:
74
56
 
75
- Events offset from a base event (typically Easter).
57
+ ```ts
58
+ import { EASTER, ASH_WEDNESDAY, PALM_SUNDAY, PENTECOST } from "calendaryjs-plugin-liturgical";
76
59
 
77
- ```typescript
78
- {
79
- type: 'offset';
80
- id: string;
81
- baseEvent: string; // ID of the base event
82
- offsetDays: number; // Days offset (negative = before, positive = after)
83
- title?: string;
84
- // ... other standard event properties
85
- }
60
+ cal.addGroup({ id: "church", events: [EASTER, ASH_WEDNESDAY, PALM_SUNDAY, PENTECOST] });
86
61
  ```
87
62
 
88
- ## Common Liturgical Offsets
89
-
90
- | Event | Offset from Easter |
91
- | -------------- | ------------------ |
92
- | Ash Wednesday | -46 |
93
- | Palm Sunday | -7 |
94
- | Holy Thursday | -3 |
95
- | Good Friday | -2 |
96
- | Holy Saturday | -1 |
97
- | Easter Monday | +1 |
98
- | Ascension | +39 |
99
- | Pentecost | +49 |
100
- | Trinity Sunday | +56 |
101
- | Corpus Christi | +60 |
102
-
103
- ## Example: Full Liturgical Year
104
-
105
- ```typescript
106
- import { calendary } from "calendaryjs";
107
- import { liturgical } from "calendaryjs-plugin-liturgical";
108
-
109
- const cal = calendary();
110
- cal.use(liturgical());
111
-
112
- cal.addGroup({
113
- id: "liturgical",
114
- name: "Liturgical Calendar",
115
- events: [
116
- // Easter
117
- { type: "easter", id: "easter", title: "Easter Sunday" },
118
-
119
- // Lent
120
- { type: "offset", id: "ash-wed", baseEvent: "easter", offsetDays: -46, title: "Ash Wednesday" },
121
-
122
- // Holy Week
123
- {
124
- type: "offset",
125
- id: "palm-sunday",
126
- baseEvent: "easter",
127
- offsetDays: -7,
128
- title: "Palm Sunday",
129
- },
130
- {
131
- type: "offset",
132
- id: "holy-thursday",
133
- baseEvent: "easter",
134
- offsetDays: -3,
135
- title: "Holy Thursday",
136
- },
137
- {
138
- type: "offset",
139
- id: "good-friday",
140
- baseEvent: "easter",
141
- offsetDays: -2,
142
- title: "Good Friday",
143
- },
144
- {
145
- type: "offset",
146
- id: "holy-saturday",
147
- baseEvent: "easter",
148
- offsetDays: -1,
149
- title: "Holy Saturday",
150
- },
63
+ ## Compute Easter directly
151
64
 
152
- // Easter Season
153
- {
154
- type: "offset",
155
- id: "easter-monday",
156
- baseEvent: "easter",
157
- offsetDays: 1,
158
- title: "Easter Monday",
159
- },
160
- {
161
- type: "offset",
162
- id: "divine-mercy",
163
- baseEvent: "easter",
164
- offsetDays: 7,
165
- title: "Divine Mercy Sunday",
166
- },
167
- { type: "offset", id: "ascension", baseEvent: "easter", offsetDays: 39, title: "Ascension" },
168
- { type: "offset", id: "pentecost", baseEvent: "easter", offsetDays: 49, title: "Pentecost" },
65
+ ```ts
66
+ import { computeEaster, easterRelativeDate } from "calendaryjs-plugin-liturgical";
169
67
 
170
- // Ordinary Time
171
- { type: "offset", id: "trinity", baseEvent: "easter", offsetDays: 56, title: "Trinity Sunday" },
172
- {
173
- type: "offset",
174
- id: "corpus-christi",
175
- baseEvent: "easter",
176
- offsetDays: 60,
177
- title: "Corpus Christi",
178
- },
179
- ],
180
- });
68
+ computeEaster(2025); // Date — Easter Sunday 2025
69
+ easterRelativeDate(2025, 49); // Date Pentecost (Easter + 49)
181
70
  ```
182
71
 
183
- ## Easter Calculation
184
-
185
- The plugin uses the Computus algorithm to calculate Easter dates:
186
-
187
- ```typescript
188
- import { computeEaster } from "calendaryjs-plugin-liturgical";
189
-
190
- const easter2025 = computeEaster(2025);
191
- // Returns: Date object for Easter Sunday 2025
192
- ```
72
+ ## Reference
193
73
 
194
- ## Related Packages
74
+ **Event types** — `easter` · `offset` (`baseEvent` + `offsetDays`), plus every standard
75
+ [event property](https://www.npmjs.com/package/calendaryjs#event-properties).
195
76
 
196
- - [calendaryjs](https://www.npmjs.com/package/calendaryjs) - Core package
197
- - [calendaryjs-plugin-lunar](https://www.npmjs.com/package/calendaryjs-plugin-lunar) - Lunar calendar
77
+ **Exports** — `liturgical()` · presets (`EASTER`, `PENTECOST`, `GOOD_FRIDAY`…) ·
78
+ `computeEaster` · `easterRelativeDate` · daily-calendar utils (`getLiturgicalDay`, `getSeason`…).
198
79
 
199
80
  ## License
200
81
 
package/dist/index.cjs CHANGED
@@ -5,7 +5,7 @@ var calendaryjs = require('calendaryjs');
5
5
  // package.json
6
6
  var package_default = {
7
7
  name: "calendaryjs-plugin-liturgical",
8
- version: "0.1.1"};
8
+ version: "0.1.2"};
9
9
 
10
10
  // src/computus.ts
11
11
  function computeEaster(year) {
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import { addDays, parseDate, formatDate, daysBetween, resolveConflict, getYear,
3
3
  // package.json
4
4
  var package_default = {
5
5
  name: "calendaryjs-plugin-liturgical",
6
- version: "0.1.1"};
6
+ version: "0.1.2"};
7
7
 
8
8
  // src/computus.ts
9
9
  function computeEaster(year) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "calendaryjs-plugin-liturgical",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Catholic liturgical calendar plugin for calendaryjs — Easter computus and movable feasts.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -39,7 +39,7 @@
39
39
  "date-easter": "^1.0.3",
40
40
  "typescript": "^5.3.2",
41
41
  "vitest": "^4.0.18",
42
- "calendaryjs": "0.2.1"
42
+ "calendaryjs": "0.2.2"
43
43
  },
44
44
  "files": [
45
45
  "dist"