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

Extend Inst protocol to org.joda.time.DateTime #248

Closed
glts opened this issue May 10, 2018 · 1 comment · Fixed by #249
Closed

Extend Inst protocol to org.joda.time.DateTime #248

glts opened this issue May 10, 2018 · 1 comment · Fixed by #249

Comments

@glts
Copy link

glts commented May 10, 2018

Clojure 1.9 introduced the Inst protocol and with it the predicate inst? and the accessor/conversion operation inst-ms.

Out of the box, Inst is extended to java.util.Date and, on Java 8 and later, to java.time.Instant.

(inst? (java.util.Date.))        ;; => true
(inst? (java.time.Instant/now))  ;; => true
(inst? (clj-time.core/now))      ;; => false

Please consider extending the Inst protocol to org.joda.time.DateTime on Clojure 1.9 and later. This would help improve interoperability and using insts more independently of the concrete implementation. Since clj-time in some sense has a de facto ‘ownership’ of org.joda.time.DateTime in the Clojure library world, I believe you are best suited to do such a protocol extension.

Thank you!

@seancorfield
Copy link
Member

Sounds reasonable. PR, with tests, welcome.

Note: if you're on Java 8 or later, you should consider migrating from Joda Time/clj-time to Java Time (and, perhaps, clojure.java-time if you want a wrapper library).

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

Successfully merging a pull request may close this issue.

2 participants