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 how to compute differences between dates, e.g. nr. days between two dates #44

Open
holyjak opened this issue Nov 22, 2019 · 1 comment

Comments

@holyjak
Copy link
Contributor

@holyjak holyjak commented Nov 22, 2019

Should we just use .until or is there something built-in? In any case it would be worth documenting, finding out how many days / months / ... is between two days is common I'd believe.
Now I do

(.until (jt/local-date "2019-01-01") (jt/local-date "2019-02-13") (java.time.temporal.ChronoUnit/DAYS))

I have tried to do

(jt/as (jt/period (jt/local-date "2019-01-01") (jt/local-date "2019-02-13")) :days)
``` but it fails with "Period contains years or months"
@lucasemmoreira
Copy link

@lucasemmoreira lucasemmoreira commented Jun 26, 2020

I would like to know this information as well. Thanks for your solution, @holyjak ! It worked here.

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

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.