Document new cal-day.
This commit is contained in:
		
							parent
							
								
									38a1ba6c95
								
							
						
					
					
						commit
						923faa0e84
					
				
					 1 changed files with 72 additions and 0 deletions
				
			
		|  | @ -22,6 +22,8 @@ with calendar dates - mostly with month granularity. | |||
| 
 | ||||
| ### Month | ||||
| 
 | ||||
|     (import cal-month) | ||||
| 
 | ||||
| Module for handling months algebra to be used in period construction | ||||
| and matching. | ||||
| 
 | ||||
|  | @ -136,6 +138,8 @@ Returns a new valid month that comes ```n``` months after ```m```. If | |||
| 
 | ||||
| ### Period | ||||
| 
 | ||||
|     (import cal-period) | ||||
| 
 | ||||
| This module implements simple calendar period handling with month | ||||
| granularity. The period contains fields ```since``` which is the first | ||||
| month of the period and ```before``` which is the first month just | ||||
|  | @ -261,3 +265,71 @@ If ```v``` is a valid month, returns it unchanged. If it is a day, | |||
| uses ```cal-day->month``` for conversion with given ```stop?``` as | ||||
| second argument. | ||||
| 
 | ||||
| ### Day | ||||
| 
 | ||||
|     (import cal-day) | ||||
| 
 | ||||
| This module encapsulates date storage with daily granularity. | ||||
| 
 | ||||
|     (make-cal-day y m d) | ||||
| 
 | ||||
| * ```y``` - valid year (1000-9999) | ||||
| * ```m``` - valid month number (1-12) | ||||
| * ```d``` - valid day number (1-31) | ||||
| 
 | ||||
| Construct a new cal-day structure representing a single calendar day. | ||||
| 
 | ||||
|     (cal-day? v) | ||||
| 
 | ||||
| * ```v``` - any value | ||||
| 
 | ||||
| Return ```#t``` if given value is a cal-day structure and it | ||||
| represents a valid day, ```#f``` otherwise. | ||||
| 
 | ||||
|     (cal-day-year d) | ||||
| 
 | ||||
| * ```d``` - valid cal-day structure | ||||
| 
 | ||||
| Returns the year field of the structure. | ||||
| 
 | ||||
|     (cal-day-month d) | ||||
| 
 | ||||
| * ```d``` - valid cal-day structure | ||||
| 
 | ||||
| Returns the month field of the structure. | ||||
| 
 | ||||
|     (cal-day-day d) | ||||
| 
 | ||||
| * ```d``` - valid cal-day structure | ||||
| 
 | ||||
| Returns the day field of the structure. | ||||
| 
 | ||||
|     (cal-day->month d [stop?]) | ||||
| 
 | ||||
| * ```d``` - a valid cal-day structure | ||||
| * ```stop?``` - if ```#t```, conversion for period end | ||||
| 
 | ||||
| Converts given cal-day to cal-month. If ```stop?``` is ```#f```, it | ||||
| just strips the day number. Otherwise it converts the day to the same | ||||
| month only if it is the first day of the month. It converts to the | ||||
| next calendar month otherwise. | ||||
| 
 | ||||
|     (cal-day->string d) | ||||
| 
 | ||||
| * ```d``` - a valid cal-day structure | ||||
| 
 | ||||
| Converts given day into "YYYY-MM-DD" ISO string representation. | ||||
| 
 | ||||
|     (string->cal-day s) | ||||
| 
 | ||||
| * ```s``` - a string containing "YYYY-MM-DD" ISO date | ||||
| 
 | ||||
| Parses the string and returns a valid cal-day structure. | ||||
| 
 | ||||
|     (parse-cal-day/month s) | ||||
| 
 | ||||
| * ```s``` - a string with ISO date with optional day part | ||||
| 
 | ||||
| Tries parsing the string as cal-day and returns the result upon | ||||
| success. Upon failure, parses the string as cal-month. | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue