New day period exports.

This commit is contained in:
Dominik Pantůček 2023-05-22 14:57:49 +02:00
parent 71687849c4
commit f639ec5753

View file

@ -44,6 +44,9 @@
cal-month-in-period? cal-month-in-period?
cal-month-in-periods? cal-month-in-periods?
cal-day-in-period?
cal-day-in-periods?
cal-periods->string cal-periods->string
cal-periods-match cal-periods-match
@ -227,6 +230,18 @@
(cal-day<? d before)) (cal-day<? d before))
(not (cal-day<? d since))))) (not (cal-day<? d since)))))
;; Returns true if the day belongs to at least one period
(define (cal-day-in-periods? ps . dl)
(let ((d (if (null? dl)
(*current-day*)
(cal-ensure-day (car dl)))))
(let loop ((ps ps))
(if (null? ps)
#f
(if (cal-day-in-period? (car ps) d)
#t
(loop (cdr ps)))))))
;; Returns string representing a month period with possibly open end. ;; Returns string representing a month period with possibly open end.
(define (cal-period->string p) (define (cal-period->string p)
(sprintf "~A..~A" (sprintf "~A..~A"