seancorfield/clj-time — Issue #1: in-* interval functions could use toPeriod?
Author: seancorfield
Created: 2011-10-28 22:54:38+00:00
State: open

I looked for in-years but it isn't present. The obvious implementation would be:

(defn in-years [in] (.getYears (.toPeriod in (PeriodType/years))))

(suitably type hinted).

Given that, it would make sense to implement the other in-* functions in terms of .toPeriod.

Given clj-time provides (years n) - and similarly for months, weeks, days etc - perhaps add zero-argument versions that provide Period objects?

(defn years ([] (PeriodType/years)) ([n] (Period n)))
(defn in-years [in] (.getYears (.toPeriod in (years))))