Skip to content

Commit

Permalink
added prior-open to calendar.core
Browse files Browse the repository at this point in the history
  • Loading branch information
wizard50 committed Oct 13, 2024
1 parent fa95a5a commit 84003d8
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/calendar/src/ta/calendar/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,19 @@
_ (assert dt "current close dt is nil.")]
(current-close-dt calendar dt)))

(defn prior-open
"dt needs to be calendar-time,
use current-open to align clock-time to calendar-time"
[[calendar-kw interval-kw] dt]
(let [calendar (calendar-kw calendars)
interval (interval-kw intervals)
_ (assert calendar)
_ (assert interval)
;_ (println "calendar: " calendar)
;_ (println "interval: " interval)
prior-open-dt (:prior-open interval)]
(prior-open-dt calendar dt)))

(defn close->open-dt [[calendar-kw interval-kw] & [dt]]
(let [dt (if dt dt (t/now))
calendar (calendar-kw calendars)
Expand Down

0 comments on commit 84003d8

Please sign in to comment.