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

Extending API to Instant #65

Closed
currentoor opened this issue Oct 25, 2019 · 5 comments
Closed

Extending API to Instant #65

currentoor opened this issue Oct 25, 2019 · 5 comments

Comments

@currentoor
Copy link
Contributor

I'm using this project with Datomic, which can only store java.time.Date values natively. So I do this sort of thing all the time.

(t/inst (t/+ (t/instant #inst "...") (t/new-duration 10 :minutes))) => #inst "..."

Would you be interested in a PR that extends the API to do this conversion internally for inst's? So then we can just do this

(t/+ #inst "..." (t/new-duration 10 :minutes)) => #inst "..."
@currentoor
Copy link
Contributor Author

@henryw374 mentioning you just in case you don't see this.

@henryw374
Copy link
Collaborator

Hi.

This would work for you in current version:

(t/>> (java.util.Date.) (t/new-duration 10 :minutes))

I'm in 2 minds about ITimeShift and ITimeArithmetic generally. There's overlap between them and ITimeShift doesn't seem quite right to me.

@currentoor
Copy link
Contributor Author

Oh ok, wonderful I'll just use that then. Thanks! 👍

@awb99
Copy link

awb99 commented Feb 13, 2022

I notice a bug in the latest tick verion. The type changes when I run tick/>>. So I have to cast to t/inst:

(-> (t/>> (t/inst) (t/new-duration 30 :days))      t/inst)

@henryw374
Copy link
Collaborator

ok weird. I can't see how that worked before.

@henryw374 henryw374 reopened this Feb 13, 2022
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

3 participants