Match fee periods properly.

This commit is contained in:
Dominik Pantůček 2023-12-23 19:48:43 +01:00
parent b9030db455
commit 28dd25998b
3 changed files with 34 additions and 1 deletions

View file

@ -53,6 +53,8 @@
cal-month-in-period?
cal-month-in-periods?
cal-month-find-period
cal-day-in-period?
cal-day-in-periods?
@ -265,6 +267,19 @@
#t
(loop (cdr ps)))))))
;; Returns true if given month is in at least one of the periods
;; given. Defaults to current month.
(define (cal-month-find-period ps . ml)
(let ((m (if (null? ml)
(*current-month*)
(car ml))))
(let loop ((ps ps))
(if (null? ps)
#f
(if (cal-month-in-period? (car ps) m)
(car ps)
(loop (cdr ps)))))))
;; Checks whether given day belongs to day or month period
(define (cal-day-in-period? p . dl)
(let ((d (if (null? dl)