diff options
Diffstat (limited to 'haunt/post.scm')
-rw-r--r-- | haunt/post.scm | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/haunt/post.scm b/haunt/post.scm index 08c8872..361fd6d 100644 --- a/haunt/post.scm +++ b/haunt/post.scm @@ -34,6 +34,8 @@ post-metadata post-ref post-slug + %default-date + post-date posts/reverse-chronological posts/group-by-tag @@ -59,6 +61,14 @@ char-set:whitespace)) "-")) +(define %default-date + (make-date 0 0 0 0 1 1 1970 0)) ; UNIX epoch + +(define (post-date post) + "Return the date for POST, or '%default-date' if no date is +specified." + (or (post-ref post 'date) %default-date)) + (define (post-time post) (date->time-utc (post-ref post 'date))) |