diff options
| author | Matthew Fennell <matthew@fennell.dev> | 2026-04-16 16:24:05 +0100 |
|---|---|---|
| committer | Matthew Fennell <matthew@fennell.dev> | 2026-04-16 18:34:46 +0100 |
| commit | 635960c4a470bbbd0f25120bdc65fa1b060f5b03 (patch) | |
| tree | 625c636637f15ff43992a8b2e1914c33189e0e15 | |
| parent | 7770aa9aa15f35997b75a0da961ca778af542557 (diff) | |
Extract 10pm-adjusted-date to a function
This is useful in other functions as well, as it's essentially "better.org.uk's
definition of the current date regarding what bookings are available".
| -rw-r--r-- | util.scm | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -89,10 +89,13 @@ (date-hour date) 0 0 0 0)) +(define (10pm-adjusted-date date) + (let ((date-offset (if (> (date-hour date) 22) 1 0))) + (date+ (current-date) date-offset))) + (define (this day-name) (log-msg 'DEBUG "Calculating next " day-name) - (let* ((date-offset (if (> (date-hour (current-date)) 22) 1 0)) - (current-date (date+ (current-date) date-offset)) + (let* ((current-date (10pm-adjusted-date (current-date))) (current-week-day (date-week-day current-date)) (target-week-day (day-name->week-day day-name)) (days-ahead (mod (- target-week-day current-week-day) 7)) |
