diff options
Diffstat (limited to 'internal/caldata')
| -rw-r--r-- | internal/caldata/readings.go | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/internal/caldata/readings.go b/internal/caldata/readings.go index d082e26..2b3b5af 100644 --- a/internal/caldata/readings.go +++ b/internal/caldata/readings.go @@ -66,6 +66,9 @@ func Readings(sel calendar.Selection, layers []calendar.Layer, date time.Time, d if r := efEpiphanytideOpeningReadings(day); len(r) > 0 { return r } + if r := efEpiphanyWeekReadings(day); len(r) > 0 { + return r + } if r := TemporalReadings("old", day.Observed.Slug); len(r) > 0 { return r } @@ -222,3 +225,49 @@ func efEpiphanytideOpeningReadings(day calendar.LiturgicalDay) []calendar.Readin {Part: "gospel", Citation: "Luke 2:21"}, } } + +// efEpiphanyWeekReadings returns the Mass of a FERIAL day between Epiphany and +// the first Sunday after it. +// +// Those days repeat the Epiphany's own Mass, Isa 60:1-6 / Matt 2:1-12. The +// ferias AFTER that Sunday take the Sunday's Mass instead (Rom 12:1-5 / +// Luke 2:42-52), which is what the walk-back already gives them correctly. +// +// lectio cannot tell the two groups apart by slug: both are +// ef-time-after-epiphany-1-<weekday>, because the week numbering starts at the +// Sunday and the days before it fall in the same numbered week. So the split +// is made here, on the date, against the same anchor efWeek uses. +// +// Saturdays are excluded by the BVM check running before this one -- an +// unoccupied Saturday in the window carries Our Lady's office and her Mass. +// colitur reaches the same result by listing only the five non-Saturday +// weekdays in its own table. +func efEpiphanyWeekReadings(day calendar.LiturgicalDay) []calendar.Reading { + if day.Date.Month() != time.January || day.Date.Day() < 7 { + return nil + } + if !day.Date.Before(firstSundayAfterEpiphanyForReadings(day.Date.Year())) { + return nil + } + if !strings.HasPrefix(day.Observed.Slug, "ef-") || day.Weekday == time.Sunday { + return nil + } + if !strings.Contains(day.Observed.Slug, "-epiphany-") && !strings.Contains(day.Observed.Slug, "-christmas-") { + return nil + } + return []calendar.Reading{ + {Part: "first", Citation: "Isa 60:1-6"}, + {Part: "gospel", Citation: "Matt 2:1-12"}, + } +} + +// firstSundayAfterEpiphanyForReadings mirrors calendar's own anchor. Duplicated +// rather than exported because the two packages are separate and one date +// helper is a smaller cost than widening an API for it. +func firstSundayAfterEpiphanyForReadings(y int) time.Time { + d := time.Date(y, time.January, 7, 0, 0, 0, 0, time.UTC) + for d.Weekday() != time.Sunday { + d = d.AddDate(0, 0, 1) + } + return d +} |
