diff options
Diffstat (limited to 'lib/kernel/layer.ml')
| -rw-r--r-- | lib/kernel/layer.ml | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/kernel/layer.ml b/lib/kernel/layer.ml index f069546..2a072f0 100644 --- a/lib/kernel/layer.ml +++ b/lib/kernel/layer.ml @@ -73,8 +73,12 @@ let index t ~easter ~years = Hashtbl.iter (fun k v -> Hashtbl.replace movable k (canonical v)) movable; { fixed; movable } -let on_date idx date = - let f = try Hashtbl.find idx.fixed (Date.month date, Date.day date) with Not_found -> [] in +let on_date ?(fixed_key = fun d -> Some (Date.month d, Date.day d)) idx date = + let f = + match fixed_key date with + | None -> [] + | Some k -> ( try Hashtbl.find idx.fixed k with Not_found -> []) + in let m = try Hashtbl.find idx.movable (Date.to_rata date) with Not_found -> [] in match m with [] -> f | _ -> canonical (f @ m) |
