cljs-time
cljs-time copied to clipboard
Document interval vs period data types
It seems that cljs-time supports two different data structures: interval and period. They available in public API via cljs-time.core/interval
and cljs-time.core/period
. Only interval is documented. What's purpose for period and what's differences from interval?
Having had a quick look:
- Intervals have a specific start and end (i.e. is between two date-times)
- Periods is a representation of an Interval as being 2 years, 3 months and 2 days etc.
It should be apparent that you can convert any interval to a unique period, but not the other way around.
EDIT: did a bit more reading... cljs-time follows clj-time API closely, which is based on Joda time. This SO post explains interval/period/durations in Joda world.
goog.date
, on which cljs-time is based, only implements intervals, but no periods.