aboutsummaryrefslogtreecommitdiff
path: root/module/datetime
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2020-04-26 01:30:03 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2020-04-26 01:30:03 +0200
commit36d1aac8f08bc20e499563805a280a795f9cdfb2 (patch)
treeea42d4466e61c522612c4b1cbf9e6add5e648758 /module/datetime
parentHTML Description exception handler now works. (diff)
downloadcalp-36d1aac8f08bc20e499563805a280a795f9cdfb2.tar.gz
calp-36d1aac8f08bc20e499563805a280a795f9cdfb2.tar.xz
Add some comments.
Diffstat (limited to '')
-rw-r--r--module/datetime.scm1
-rw-r--r--module/datetime/util.scm4
2 files changed, 5 insertions, 0 deletions
diff --git a/module/datetime.scm b/module/datetime.scm
index d8a61af0..0cca216b 100644
--- a/module/datetime.scm
+++ b/module/datetime.scm
@@ -737,6 +737,7 @@
`(datetime date: ,(parse-date% date)
time: ,(parse-time% time)
tz: ,(and (string= "Z" (string-take-right str 1))
+ ;; TODO shouldn't this be "UTC"?
'Z))))
(define (date-reader chr port)
diff --git a/module/datetime/util.scm b/module/datetime/util.scm
index a8ccda07..8c57636e 100644
--- a/module/datetime/util.scm
+++ b/module/datetime/util.scm
@@ -116,6 +116,9 @@
(date+ ystart (date day: (abs day-index)))
(date- ystart (date day: day-index)))))
+;; TODO v. 1 sometimes is calculated wrong.
+;; (week-number #2020-01-01 mon) ; => 1
+;; (week-number #2019-12-31 mon) ; => 53 ; should be 1
(define*-public (week-number date optional: (wkst sun))
(let* ((week day (floor/ (days-in-interval (week-1-start date wkst) date)
7)))
@@ -300,6 +303,7 @@
(* 12 (year diff)))
(month-stream start-date)))))))
+;; also known as Julian day.
(define-public (year-day date)
(days-in-interval (start-of-year date) date))