calendaryjs-plugin-liturgical 0.1.1 → 0.1.3
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 +41 -154
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,200 +1,87 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://cdn.jsdelivr.net/npm/calendaryjs/assets/logo.svg" alt="calendaryjs" width="380" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
1
5
|
# calendaryjs-plugin-liturgical
|
|
2
6
|
|
|
3
|
-
|
|
7
|
+
> **New to calendaryjs?** Start with the [core README](https://www.npmjs.com/package/calendaryjs) — this plugin builds on its engine.
|
|
4
8
|
|
|
5
|
-
|
|
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.
|
|
6
12
|
|
|
7
|
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
|
|
13
|
+
<p align="center">
|
|
14
|
+
<a href="https://www.npmjs.com/package/calendaryjs-plugin-liturgical"><img alt="npm" src="https://img.shields.io/npm/v/calendaryjs-plugin-liturgical?style=for-the-badge&color=f59e0b&labelColor=16120F" /></a>
|
|
15
|
+
<a href="https://socket.dev/npm/package/calendaryjs-plugin-liturgical"><img alt="Socket" src="https://img.shields.io/badge/Socket-security-f59e0b?style=for-the-badge&labelColor=16120F" /></a>
|
|
16
|
+
<img alt="Zero dependencies" src="https://img.shields.io/badge/deps-zero-22c55e?style=for-the-badge&labelColor=16120F" />
|
|
17
|
+
</p>
|
|
11
18
|
|
|
12
|
-
##
|
|
19
|
+
## Install
|
|
13
20
|
|
|
14
21
|
```bash
|
|
15
|
-
|
|
22
|
+
npm i calendaryjs calendaryjs-plugin-liturgical
|
|
16
23
|
```
|
|
17
24
|
|
|
18
|
-
##
|
|
19
|
-
|
|
20
|
-
- `calendaryjs` >= 0.1.0
|
|
25
|
+
## Use it
|
|
21
26
|
|
|
22
|
-
|
|
27
|
+
Register the plugin, then declare `easter` and `offset` events — an `offset` is placed
|
|
28
|
+
relative to Easter (negative = before, positive = after):
|
|
23
29
|
|
|
24
|
-
```
|
|
30
|
+
```ts
|
|
25
31
|
import { calendary } from "calendaryjs";
|
|
26
32
|
import { liturgical } from "calendaryjs-plugin-liturgical";
|
|
27
33
|
|
|
28
|
-
const cal = calendary();
|
|
29
|
-
cal.use(liturgical());
|
|
34
|
+
const cal = calendary().use(liturgical());
|
|
30
35
|
|
|
31
36
|
cal.addGroup({
|
|
32
37
|
id: "church",
|
|
33
|
-
name: "Church Calendar",
|
|
34
38
|
events: [
|
|
35
39
|
{ type: "easter", id: "easter", title: "Easter Sunday" },
|
|
36
|
-
{ type: "offset", id: "ash-wed", baseEvent: "easter", offsetDays: -46, title: "Ash Wednesday" },
|
|
37
40
|
{
|
|
38
41
|
type: "offset",
|
|
39
|
-
id: "
|
|
42
|
+
id: "ash-wednesday",
|
|
40
43
|
baseEvent: "easter",
|
|
41
|
-
offsetDays: -
|
|
42
|
-
title: "
|
|
44
|
+
offsetDays: -46,
|
|
45
|
+
title: "Ash Wednesday",
|
|
43
46
|
},
|
|
44
47
|
{
|
|
45
48
|
type: "offset",
|
|
46
|
-
id: "
|
|
49
|
+
id: "palm-sunday",
|
|
47
50
|
baseEvent: "easter",
|
|
48
|
-
offsetDays: -
|
|
49
|
-
title: "
|
|
51
|
+
offsetDays: -7,
|
|
52
|
+
title: "Palm Sunday",
|
|
50
53
|
},
|
|
51
54
|
{ type: "offset", id: "pentecost", baseEvent: "easter", offsetDays: 49, title: "Pentecost" },
|
|
52
55
|
],
|
|
53
56
|
});
|
|
54
57
|
|
|
55
|
-
|
|
58
|
+
cal.getEventsInRange("2025-01-01", "2025-12-31");
|
|
56
59
|
```
|
|
57
60
|
|
|
58
|
-
|
|
61
|
+
Common feasts ship as ready-made presets:
|
|
59
62
|
|
|
60
|
-
|
|
63
|
+
```ts
|
|
64
|
+
import { EASTER, ASH_WEDNESDAY, PALM_SUNDAY, PENTECOST } from "calendaryjs-plugin-liturgical";
|
|
61
65
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
```typescript
|
|
65
|
-
{
|
|
66
|
-
type: 'easter';
|
|
67
|
-
id: string;
|
|
68
|
-
title?: string;
|
|
69
|
-
// ... other standard event properties
|
|
70
|
-
}
|
|
66
|
+
cal.addGroup({ id: "church", events: [EASTER, ASH_WEDNESDAY, PALM_SUNDAY, PENTECOST] });
|
|
71
67
|
```
|
|
72
68
|
|
|
73
|
-
|
|
69
|
+
## Compute Easter directly
|
|
74
70
|
|
|
75
|
-
|
|
71
|
+
```ts
|
|
72
|
+
import { computeEaster, easterRelativeDate } from "calendaryjs-plugin-liturgical";
|
|
76
73
|
|
|
77
|
-
|
|
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
|
-
}
|
|
74
|
+
computeEaster(2025); // → Date — Easter Sunday 2025
|
|
75
|
+
easterRelativeDate(2025, 49); // → Date — Pentecost (Easter + 49)
|
|
86
76
|
```
|
|
87
77
|
|
|
88
|
-
##
|
|
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
|
-
},
|
|
151
|
-
|
|
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" },
|
|
169
|
-
|
|
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
|
-
});
|
|
181
|
-
```
|
|
182
|
-
|
|
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
|
-
```
|
|
78
|
+
## Reference
|
|
193
79
|
|
|
194
|
-
|
|
80
|
+
**Event types** — `easter` · `offset` (`baseEvent` + `offsetDays`), plus every standard
|
|
81
|
+
[event property](https://www.npmjs.com/package/calendaryjs#event-properties).
|
|
195
82
|
|
|
196
|
-
|
|
197
|
-
|
|
83
|
+
**Exports** — `liturgical()` · presets (`EASTER`, `PENTECOST`, `GOOD_FRIDAY`…) ·
|
|
84
|
+
`computeEaster` · `easterRelativeDate` · daily-calendar utils (`getLiturgicalDay`, `getSeason`…).
|
|
198
85
|
|
|
199
86
|
## License
|
|
200
87
|
|
package/dist/index.cjs
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "calendaryjs-plugin-liturgical",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
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.
|
|
42
|
+
"calendaryjs": "0.2.4"
|
|
43
43
|
},
|
|
44
44
|
"files": [
|
|
45
45
|
"dist"
|