diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-07-28 15:07:12 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-07-28 15:07:12 +0200 |
| commit | 310ac404f25b412c5c1ead12247b4eb36e9f0025 (patch) | |
| tree | 6e1dcc5e1f85a483cef7044d341b7c940c1690a8 /internal/calendar/calendar.go | |
| parent | 44472bbe31475a3c672ae003d928d7caffb4b50a (diff) | |
| parent | c5abf87fa7198c8f245f407774e2326e4b6c9b9c (diff) | |
| download | lectio-310ac404f25b412c5c1ead12247b4eb36e9f0025.tar.gz lectio-310ac404f25b412c5c1ead12247b4eb36e9f0025.zip | |
Merge branch 'engine-precedence-fixes': OF/EF calendar+readings flawlessness pass
Per-day validation vs litcal (OF) and missalemeum (EF) 2005-2050, all defects
fixed and re-validated to zero: OF calendar 0 real errors forward, OF readings
0 unresolvable, EF 0 reading gaps + resumed Sundays correct.
Diffstat (limited to 'internal/calendar/calendar.go')
| -rw-r--r-- | internal/calendar/calendar.go | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/internal/calendar/calendar.go b/internal/calendar/calendar.go index d224e87..33706d8 100644 --- a/internal/calendar/calendar.go +++ b/internal/calendar/calendar.go @@ -18,6 +18,19 @@ func Compute(date time.Time, sel Selection, layers []Layer) LiturgicalDay { return computeOF(date, sel, layers) } +// TemporalSlug returns the slug of date's TEMPORAL day (the season's Sunday or +// feria), ignoring any sanctoral celebration that outranks it. The EF's +// green-season weekday-repeats-the-Sunday rule uses this so a Monday still finds +// its Sunday Mass even when that Sunday was displaced by a feast (e.g. the +// Purification on Feb 2). +func TemporalSlug(date time.Time, sel Selection) string { + date = date.UTC().Truncate(24 * time.Hour) + if sel.Form == "old" { + return temporalEF(date).Cel.Slug + } + return temporal(date, sel).Cel.Slug +} + // computeEF computes the Extraordinary Form (1962) day. func computeEF(date time.Time, sel Selection, layers []Layer) LiturgicalDay { td := temporalEF(date) @@ -145,10 +158,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) |
