This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require '[clj-time.predicates :as p] | |
'[clj-time.core :as c] | |
'[clj-time.periodic :as pe]) | |
(defn days-after [date] | |
(rest (pe/periodic-seq date (c/days 1)))) | |
(defn holiday? [date] | |
;Depends... no holidays for now | |
false) | |
(defn after-1pm? [date] | |
(> (c/hour date) 13)) | |
(defn available? [date] | |
(not (or (p/saturday? date) (p/sunday? date) (holiday? date)))) | |
(defn next-available [date] | |
(let [available-days (filter available? (days-after date))] | |
((if (after-1pm? date) second first) | |
available-days))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment