Document new cal-period procedures.

This commit is contained in:
Dominik Pantůček 2023-05-22 20:34:23 +02:00
parent 1e59177e15
commit b4736c25eb

View file

@ -152,6 +152,12 @@ after the period.
Configuration parameter specifying the current month. Defaults to the Configuration parameter specifying the current month. Defaults to the
current month derived from the current system time. current month derived from the current system time.
(*current-day* [day])
* ```day``` - a valid cal-day structure
Configuration parameter specifying the current day. Defaults to
current date.
(make-cal-period since before [scomment [bcomment]]) (make-cal-period since before [scomment [bcomment]])
@ -222,6 +228,24 @@ Returns ```#t``` if given month ```m``` lies within the period
Returns ```#t``` if given month ```m``` lies within any of the periods Returns ```#t``` if given month ```m``` lies within any of the periods
given in the list of periods ```ps```. given in the list of periods ```ps```.
(cal-day-in-period? p [d])
* ```p``` - a valid cal-period structure
* ```d``` - a valid cal-day or cal-month
Checks whether given day ```d``` (or month, after conversion to the
first day of given month) belongs to period specified by ```p```. The
period is converted to cal-day period if it is a cal-month period. The
tested day ```d``` defaults to ```(*current-day*)```.
(cal-day-in-periods? ps [d])
* ```ps``` - a list of valid cal-period structures
* ```d``` - a valid cal-day or cal-month
Returns ```#t``` if ```cal-day-in-period?``` returns ```#t``` for at
least one period in the ```ps``` list.
(cal-periods->string ps) (cal-periods->string ps)
* ```ps``` - a list of periods * ```ps``` - a list of periods
@ -265,6 +289,14 @@ If ```v``` is a valid month, returns it unchanged. If it is a day,
uses ```cal-day->month``` for conversion with given ```stop?``` as uses ```cal-day->month``` for conversion with given ```stop?``` as
second argument. second argument.
(cal-ensure-day v)
* ```v``` - a valid cal-day or cal-month or ```#f```
Returns a valid cal-day structure based on ```v```. If it is a cal-day
or ```#f```, returns it unchanged. If it is a cal-month, returns a
valid cal-day of the first day of given month.
### Day ### Day
(import cal-day) (import cal-day)