aboutsummaryrefslogtreecommitdiff
path: root/internal/calendar
diff options
context:
space:
mode:
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)