Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document interval vs period data types #115

Open
nartamonov opened this issue Oct 29, 2017 · 1 comment
Open

Document interval vs period data types #115

nartamonov opened this issue Oct 29, 2017 · 1 comment

Comments

@nartamonov
Copy link

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
Copy link
Contributor

shen-tian commented Nov 12, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants