summaryrefslogtreecommitdiff
path: root/lib/rites
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rites')
-rw-r--r--lib/rites/rite_ef/temporal_ef.ml32
1 files changed, 18 insertions, 14 deletions
diff --git a/lib/rites/rite_ef/temporal_ef.ml b/lib/rites/rite_ef/temporal_ef.ml
index 9e8bcc4..6786cd2 100644
--- a/lib/rites/rite_ef/temporal_ef.ml
+++ b/lib/rites/rite_ef/temporal_ef.ml
@@ -165,20 +165,24 @@ let sunday_slug d =
Some "ef-holy-name-sunday"
else None
| Time_after_pentecost -> (
- let easter = Computus.gregorian_easter y in
- let pentecost = Date.add_days easter 49 in
- let last_sunday = Date.add_days (advent_start y) (-7) in
- let n = days_between pentecost d / 7 in
- if same d last_sunday then
- (* The last Sunday before Advent always keeps the 24th (Last) Mass. *)
- Some "ef-time-after-pentecost-sunday-24"
- else if n > 23 then
- (* Surplus Sundays resume the Sundays after Epiphany that Septuagesima
- cut short -- the highest-numbered ones, so the 6th sits just before
- the Last. *)
- let total = days_between pentecost last_sunday / 7 in
- Some (Printf.sprintf "ef-time-after-epiphany-sunday-%d" (n - total + 7))
- else Some (Printf.sprintf "ef-time-after-pentecost-sunday-%d" n))
+ (* Reuse [week] rather than recomputing the Pentecost-relative week
+ number locally, so the two can never drift apart (see
+ test_week_sunday_slug_agree). Only the last Sunday and the resumed
+ tail are genuinely special. *)
+ match week d with
+ | None -> None
+ | Some n ->
+ let last_sunday = Date.add_days (advent_start y) (-7) in
+ if same d last_sunday then
+ (* The last Sunday before Advent always keeps the 24th (Last) Mass. *)
+ Some "ef-time-after-pentecost-sunday-24"
+ else if n > 23 then
+ (* Surplus Sundays resume the Sundays after Epiphany that Septuagesima
+ cut short -- the highest-numbered ones, so the 6th sits just before
+ the Last. *)
+ let total = match week last_sunday with Some t -> t | None -> n in
+ Some (Printf.sprintf "ef-time-after-epiphany-sunday-%d" (n - total + 7))
+ else Some (Printf.sprintf "ef-time-after-pentecost-sunday-%d" n))
| _ -> (
match week d with
| Some n -> Some (Printf.sprintf "ef-%s-sunday-%d" (season_slug_word s) n)