about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--rent.scm13
1 files changed, 13 insertions, 0 deletions
diff --git a/rent.scm b/rent.scm
index 238d97c..4d4855e 100644
--- a/rent.scm
+++ b/rent.scm
@@ -154,6 +154,19 @@ somewhere in @var{html}, a string."
    (add-duration (date->time-utc date)
                  (make-time time-duration 0 (* days 24 60 60)))))
 
+(define (make-date-comparer time-predicate)
+  "Return a predicate that compares two dates by converting them to
+times and comparing them using @var{time-predicate}."
+  (lambda (date1 date2)
+    (time-predicate (date->time-utc date1)
+                    (date->time-utc date2))))
+
+(define date<=?
+  (make-date-comparer time<=?))
+
+(define date>=?
+  (make-date-comparer time>=?))
+
 (define (all-houses)
   "Return a list of all houses on the OpenRent index page."
   (let ((html (bytevector->string (http-get* %openrent-index-url