calendaryjs-plugin-liturgical 0.1.0 → 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 +36 -155
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,200 +1,81 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
5
|
+
# calendaryjs-plugin-liturgical
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
> **New to calendaryjs?** Start with the [core README](https://www.npmjs.com/package/calendaryjs) — this plugin builds on its engine.
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
##
|
|
13
|
+
## Install
|
|
13
14
|
|
|
14
15
|
```bash
|
|
15
|
-
|
|
16
|
+
npm i calendaryjs calendaryjs-plugin-liturgical
|
|
16
17
|
```
|
|
17
18
|
|
|
18
|
-
##
|
|
19
|
+
## Use it
|
|
19
20
|
|
|
20
|
-
|
|
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
|
-
|
|
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: "
|
|
36
|
+
id: "ash-wednesday",
|
|
40
37
|
baseEvent: "easter",
|
|
41
|
-
offsetDays: -
|
|
42
|
-
title: "
|
|
38
|
+
offsetDays: -46,
|
|
39
|
+
title: "Ash Wednesday",
|
|
43
40
|
},
|
|
44
41
|
{
|
|
45
42
|
type: "offset",
|
|
46
|
-
id: "
|
|
43
|
+
id: "palm-sunday",
|
|
47
44
|
baseEvent: "easter",
|
|
48
|
-
offsetDays: -
|
|
49
|
-
title: "
|
|
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
|
-
|
|
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
|
-
|
|
55
|
+
Common feasts ship as ready-made presets:
|
|
74
56
|
|
|
75
|
-
|
|
57
|
+
```ts
|
|
58
|
+
import { EASTER, ASH_WEDNESDAY, PALM_SUNDAY, PENTECOST } from "calendaryjs-plugin-liturgical";
|
|
76
59
|
|
|
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
|
-
}
|
|
60
|
+
cal.addGroup({ id: "church", events: [EASTER, ASH_WEDNESDAY, PALM_SUNDAY, PENTECOST] });
|
|
86
61
|
```
|
|
87
62
|
|
|
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
|
-
},
|
|
63
|
+
## Compute Easter directly
|
|
151
64
|
|
|
152
|
-
|
|
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
|
-
|
|
171
|
-
|
|
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
|
-
##
|
|
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
|
-
|
|
74
|
+
**Event types** — `easter` · `offset` (`baseEvent` + `offsetDays`), plus every standard
|
|
75
|
+
[event property](https://www.npmjs.com/package/calendaryjs#event-properties).
|
|
195
76
|
|
|
196
|
-
|
|
197
|
-
|
|
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
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.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.
|
|
42
|
+
"calendaryjs": "0.2.2"
|
|
43
43
|
},
|
|
44
44
|
"files": [
|
|
45
45
|
"dist"
|
|
@@ -58,12 +58,12 @@
|
|
|
58
58
|
},
|
|
59
59
|
"repository": {
|
|
60
60
|
"type": "git",
|
|
61
|
-
"url": "git+https://github.com/
|
|
61
|
+
"url": "git+https://github.com/vbilltran68/calendaryjs.git",
|
|
62
62
|
"directory": "packages/liturgical"
|
|
63
63
|
},
|
|
64
|
-
"homepage": "https://
|
|
64
|
+
"homepage": "https://www.npmjs.com/package/calendaryjs-plugin-liturgical",
|
|
65
65
|
"bugs": {
|
|
66
|
-
"url": "https://github.com/
|
|
66
|
+
"url": "https://github.com/vbilltran68/calendaryjs/issues"
|
|
67
67
|
},
|
|
68
68
|
"scripts": {
|
|
69
69
|
"typecheck": "tsc --noEmit",
|