aboutsummaryrefslogtreecommitdiff
path: root/internal/calendar
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-07-28 14:46:17 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-07-28 14:46:17 +0200
commitcf45e9f7f3146bca6039b63e2be02463b02f8043 (patch)
tree78ce3ee214114302b39359993da865e5e334eb41 /internal/calendar
parenta80e61963756a28a3963a0442a8ccc1572518373 (diff)
downloadlectio-cf45e9f7f3146bca6039b63e2be02463b02f8043.tar.gz
lectio-cf45e9f7f3146bca6039b63e2be02463b02f8043.zip
fix(EF): fill reading gaps (major feasts, feria-repeat-through-feast, sundays)
EF readings had ~1.8% of days with no readings (major feasts falling back to the wrong Sunday, feria-repeats broken when the preceding Sunday was a feast). Now 0 gaps over 9496 days (2025-2050); reading correctness spot-checks match missalemeum except the resumed-Epiphany-Sunday edge (next commit). - calendar.TemporalSlug: the green-season weekday-repeats-the-Sunday rule uses the Sunday's TEMPORAL slug, so a Monday still finds its Sunday Mass when that Sunday was displaced by a feast (e.g. the Purification on Feb 2). - Add the missing EF temporal Masses (from missalemeum): the Nativity Day Mass (Heb 1:1-12 / John 1:1-14), Epiphany (Isa 60:1-6 / Matt 2:1-12), the Octave Day of Christmas (Titus 2:11-15 / Luke 2:21), the 6th Sunday after Epiphany (1 Thess 1:2-10 / Matt 13:31-35), and the last Sunday after Pentecost (Col 1:9-14 / Matt 24:15-35).
Diffstat (limited to 'internal/calendar')
-rw-r--r--internal/calendar/calendar.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/internal/calendar/calendar.go b/internal/calendar/calendar.go
index 9f24caf..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)