Parsing and formatting days.
This commit is contained in:
parent
46db92cc6b
commit
2e86d96b41
1 changed files with 8 additions and 0 deletions
|
@ -136,6 +136,12 @@
|
|||
(apply make-cal-day (map string->number l))
|
||||
#f)))
|
||||
|
||||
;; Parses given string as either day or month
|
||||
(define (parse-cal-day/month s)
|
||||
(let ((d (string->cal-day s)))
|
||||
(or d
|
||||
(string->cal-month s))))
|
||||
|
||||
;; Module self-tests
|
||||
(define (cal-day-tests!)
|
||||
(run-tests
|
||||
|
@ -172,6 +178,8 @@
|
|||
(test-equal? string->cal-day
|
||||
(string->cal-day "2023-05-11")
|
||||
(make-cal-day 2023 5 11))
|
||||
(test-true parse-cal-day/month
|
||||
(cal-day? (parse-cal-day/month "2023-05-11")))
|
||||
))
|
||||
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue