Skip to content

Instantly share code, notes, and snippets.

@IamDrowsy
Created February 14, 2014 19:12
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save IamDrowsy/1757211fbaeab71d80f5 to your computer and use it in GitHub Desktop.
(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