andrewmcveigh / cljs-time

A clj-time inspired date library for clojurescript.
342 stars 57 forks source link

Document interval vs period data types #115

Open nartamonov opened 6 years ago

nartamonov commented 6 years ago

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?

shen-tian commented 6 years ago

Having had a quick look:

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.