(html (head (title "sph-lib (sph time gregorian)") (link (@ (rel "stylesheet") (type "text/css") (href "/css/sph.css"))) (meta (@ (name "viewport") (content "width=device-width,initial-scale=1"))) #f) (body () (div (@ (class top)) (nav (a (@ (href "/")) "start") ", " (a (@ (href "/feed.xml")) "feed")) "") (div (@ (class "middle")) (div (@ (class mtime) (title "last modification time of the current page")) "2023-04-05") (section (h1 "(sph time gregorian)") (div (p "gregorian calendar calculations") (p "part of " (a (@ (href "../../sph-lib.html")) "sph-lib")) ((section (@ (class "library-description")) (h1 "library description") (div (p "uses a year 0 like iso8601. a year 0 appears to keep leap-day calculations simpler"))) (section (@ (class "library-name")) (h1 "module name") (p "(sph time gregorian)")) (section (@ (class "library-exports")) (h1 "exported bindings") (div (div (@ (class "doc-bindings")) (div (@ (id "doc-b-" "greg-days->leap-days") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "greg-days->leap-days") " " (span (@ (class "first-sig")) "a ->")) (div (@ (class "rest-sig")) (div "integer -> integer")) (div (@ (class "description")) (("gives the number of leap days in a given time span of full days." (br) "works with positive and negative day values and considers partial years where the leap day always falls on february 29." (br) "the calculation for negative values is similar to greg-years->leap-days, based on the fact that the formula for" (br) "positive values can be used as long as year 0 is ignored." (br) "for day totals shorter than a year we check if the leap day in year 0 has passed." (br) "for longer day totals the contained cycles are counted, like for positive values.")))) (div (@ (id "doc-b-" "greg-days->year") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "greg-days->year") " " (span (@ (class "first-sig")) "a ->")) "" "") (div (@ (id "doc-b-" "greg-days->year-days") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "greg-days->year-days") " " (span (@ (class "first-sig")) "a leap-year? ->")) "" (div (@ (class "description")) (("gives the number of days elapsed in a year. handles negative years/days")))) (div (@ (id "doc-b-" "greg-days->years") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "greg-days->years") " " (span (@ (class "first-sig")) "a ->")) (div (@ (class "rest-sig")) (div "integer -> integer")) (div (@ (class "description")) (("the number of years the given number of days fill")))) (div (@ (id "doc-b-" "greg-month->days") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "greg-month->days") " " (span (@ (class "first-sig")) "a leap-year? ->")) (div (@ (class "rest-sig")) (div "integer boolean -> integer")) (div (@ (class "description")) (("gives the number of days needed to reach the first day of the given month." (br) "months are from 1-12")))) (div (@ (id "doc-b-" "greg-month-days") (class "doc-b")) (div (span (@ (class "type")) "variable") ": " (span (@ (class "name")) "greg-month-days")) "" "") (div (@ (id "doc-b-" "greg-month-days-get") (class "doc-b")) (div (span (@ (class "type")) "syntax") ": " (span (@ (class "name")) "greg-month-days-get") " " (span (@ (class "first-sig")) "leap-year?")) "" "") (div (@ (id "doc-b-" "greg-month-days-leap-year") (class "doc-b")) (div (span (@ (class "type")) "variable") ": " (span (@ (class "name")) "greg-month-days-leap-year")) "" "") (div (@ (id "doc-b-" "greg-number-of-months") (class "doc-b")) (div (span (@ (class "type")) "variable") ": " (span (@ (class "name")) "greg-number-of-months")) "" "") (div (@ (id "doc-b-" "greg-week-day") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "greg-week-day") " " (span (@ (class "first-sig")) "year month day ->")) (div (@ (class "rest-sig")) (div "integer integer integer -> integer")) (div (@ (class "description")) (("0 being monday")))) (div (@ (id "doc-b-" "greg-year-1970-days") (class "doc-b")) (div (span (@ (class "type")) "variable") ": " (span (@ (class "name")) "greg-year-1970-days")) "" "") (div (@ (id "doc-b-" "greg-year->years") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "greg-year->years") " " (span (@ (class "first-sig")) "a ->")) "" "") (div (@ (id "doc-b-" "greg-year-days") (class "doc-b")) (div (span (@ (class "type")) "variable") ": " (span (@ (class "name")) "greg-year-days")) "" "") (div (@ (id "doc-b-" "greg-year-days->month-and-day&") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "greg-year-days->month-and-day&") " " (span (@ (class "first-sig")) "a greg-month-days c ->")) (div (@ (class "rest-sig")) (div "integer #(days-of-month ...) procedure:{month day -> any} -> any")) (div (@ (class "description")) (("get the month and month day after the given number of days have passed starting from the beginning of the year")))) (div (@ (id "doc-b-" "greg-year-days-leap-year") (class "doc-b")) (div (span (@ (class "type")) "variable") ": " (span (@ (class "name")) "greg-year-days-leap-year")) "" "") (div (@ (id "doc-b-" "greg-year-first-week-day") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "greg-year-first-week-day") " " (span (@ (class "first-sig")) "a ->")) "" "") (div (@ (id "doc-b-" "greg-year-leap-year?") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "greg-year-leap-year?") " " (span (@ (class "first-sig")) "a ->")) (div (@ (class "rest-sig")) (div "integer:year-number -> boolean")) (div (@ (class "description")) (("check if the given year is a leap year")))) (div (@ (id "doc-b-" "greg-year-weeks-53?") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "greg-year-weeks-53?") " " (span (@ (class "first-sig")) "a ->")) (div (@ (class "rest-sig")) (div "integer:year-number -> boolean")) (div (@ (class "description")) (("check if the given year number corresponds to a year with 53 instead of 52 weeks according to the iso8601 standard")))) (div (@ (id "doc-b-" "greg-years->days") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "greg-years->days") " " (span (@ (class "first-sig")) "a ->")) (div (@ (class "rest-sig")) (div "integer -> integer")) (div (@ (class "description")) (("gives the days contained in given number of fully elapsed years")))) (div (@ (id "doc-b-" "greg-years->leap-days") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "greg-years->leap-days") " " (span (@ (class "first-sig")) "a ->")) "" "") (div (@ (id "doc-b-" "greg-years->year") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "greg-years->year") " " (span (@ (class "first-sig")) "a ->")) "" (div (@ (class "description")) (("does not work reliably when year is negative and part of a date with advanced months or days," (br) "because advancing days in a negative year reduce the number of elapsed years but not the year number")))) (div (@ (id "doc-b-" "sph-time-gregorian-description") (class "doc-b")) (div (span (@ (class "type")) "variable") ": " (span (@ (class "name")) "sph-time-gregorian-description")) "" "")))))))) ()))