aboutsummaryrefslogtreecommitdiff
path: root/internal/calendar/calendar.go
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-07-28 14:35:24 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-07-28 14:35:24 +0200
commita80e61963756a28a3963a0442a8ccc1572518373 (patch)
tree602540ee619ce1d64c16e7e9ca0adb7a7cfb2194 /internal/calendar/calendar.go
parent0586599fc6020df996c4278230eeea99b9d070cb (diff)
downloadlectio-a80e61963756a28a3963a0442a8ccc1572518373.tar.gz
lectio-a80e61963756a28a3963a0442a8ccc1572518373.zip
fix(calendar): OF precedence/transfer + readings resolution; EF Pentecost octave
Fixes found by validating the offline engine per-day vs the LiturgicalCalendar API (OF) and missalemeum (EF) across 2005-2050. OF calendar is now 0 real errors in the forward window (season/cycle already perfect). OF precedence/transfer (calendar): - Ash Wednesday and Holy Week Mon-Wed are band-2 privileged, so a coinciding feast (Chair of St Peter on Ash Wednesday) is suppressed, not observed. - Solemnities transfer out of Holy Week / the Easter octave: the Annunciation defers to the Monday after the 2nd Sunday of Easter; St Joseph is anticipated to the Saturday before Palm Sunday; the Nativity of St John the Baptist moves to Jun 23 when a Lord's solemnity (Sacred Heart / Corpus Christi) falls Jun 24. - Within a precedence band, a solemnity of the Lord/BVM outranks a saint's (dignity tiebreak) rather than losing an alphabetical slug tie. - Perpetua & Felicity corrected optional -> obligatory memorial. OF readings resolution (bible.OFRef + lectionary data): - Verse-accurate Hebrew->Vulgate psalm mapping incl. the split psalms (9/10, 114/115, 116, 147); "+" verse joins and abbreviated ranges ("127-28") normalized; single-chapter books (2/3 John, Jude) get chapter 1. - Cleaned harvest artifacts from of-lectionary.ini (descriptive-suffix gospels, "or Year A" alternates, "*"/"[Vulg.]"/bracket markers, slash abbreviations); Joel/Malachi/Zechariah/Esther book-versification citations fixed to Vulgate. - Split a merged Ps 15:10/11 row in vul.tsv. Result: 0 unresolvable OF readings over 2557 rendered days (cycles A/B/C, varied Easters). EF: the Octave of Pentecost (Whit Monday-Saturday) is red, not white.
Diffstat (limited to 'internal/calendar/calendar.go')
-rw-r--r--internal/calendar/calendar.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/internal/calendar/calendar.go b/internal/calendar/calendar.go
index d224e87..9f24caf 100644
--- a/internal/calendar/calendar.go
+++ b/internal/calendar/calendar.go
@@ -145,10 +145,29 @@ func movableMemorialsOF(y int) []movableCel {
// transferIfImpeded moves a solemnity off a band-1/2 temporal day to the next
// free day. Non-solemnities are never transferred (they yield instead).
+//
+// Two impeded solemnities are ANTICIPATED (moved earlier) rather than deferred,
+// matching the General Roman Calendar's published transfers:
+// - St Joseph (Mar 19) falling in Holy Week goes to the Saturday before Palm
+// Sunday. (The Annunciation, by contrast, defers past the octave via the
+// generic forward walk below -- to the Monday after the 2nd Sunday of Easter.)
+// - The Nativity of St John the Baptist (Jun 24), when the day is a solemnity
+// of the Lord (the Sacred Heart or Corpus Christi falling on Jun 24), goes
+// to Jun 23.
func transferIfImpeded(cel Celebration, when time.Time, sel Selection) time.Time {
if cel.Rank != RankSolemnity {
return when
}
+ if strings.Contains(cel.Slug, "joseph-husband") {
+ if palm := Easter(when.Year()).AddDate(0, 0, -7); !when.Before(palm) {
+ return palm.AddDate(0, 0, -1) // Holy Week -> Saturday before Palm Sunday
+ }
+ }
+ if strings.Contains(cel.Slug, "john-the-baptist") {
+ if td := temporal(when, sel); td.Cel.Rank == RankSolemnity && td.Class == ClassLord && !td.Sunday {
+ return when.AddDate(0, 0, -1) // Sacred Heart / Corpus Christi on Jun 24 -> Jun 23
+ }
+ }
day := when
for i := 0; i < 30; i++ {
b := temporal(day, sel)