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

Interval between days #83

Open
edbond opened this issue Jan 26, 2017 · 4 comments
Open

Interval between days #83

edbond opened this issue Jan 26, 2017 · 4 comments
Labels

Comments

@edbond
Copy link

edbond commented Jan 26, 2017

I want to calculate number of days between two dates.
What am I missing here?

cljs.user=> (time-core/today)
#object[Object 20170126]
cljs.user=> (time-core/local-date 2017 1 27)
#object[Object 20170127]
cljs.user=> (time-core/interval (time-core/today) (time-core/local-date 2017 1 27))
#cljs-time.core.Interval{:start #object[Object 20170126], :end #object[Object 20170127]}
cljs.user=> (time-core/in-hours (time-core/interval (time-core/today) (time-core/local-date 2017 1 27)))
13
@edbond
Copy link
Author

edbond commented Jan 27, 2017

I have solved using to/from-default-time-zone functions. Still looks not intuitive to me.

@edbond edbond closed this as completed Jan 27, 2017
@andrewmcveigh
Copy link
Owner

(cljs-time.core/today) returns a UTC date, whereas local-* return dates in the user's timezone.

@edbond
Copy link
Author

edbond commented Jan 27, 2017

today is printed as a date without time. That's why it may be confusing. It would be nice to have Date without time for such calculations.

@andrewmcveigh
Copy link
Owner

Ah, just looking through the code. This is a bug I think, sorry.

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

No branches or pull requests

2 participants