dscarpetti / codax

An idiomatic transactional embedded database for clojure
Eclipse Public License 1.0
179 stars 9 forks source link

Fix clj-time.format/formatters #21

Open jbswetnam opened 6 years ago

jbswetnam commented 6 years ago

Library currently crashes during load due to this issue.

dscarpetti commented 6 years ago

Thanks for the PR.

I am curious under what circumstances the library is crashing? Does your project use an older version of clj-time (pre 0.12.0 or so) by chance? Around then clj-time.formatter/formatter was updated (and updated again) to allow keyword arguments.

That said, as we are using one of the default fomatters, so there may be some slight advantage in clarity and performance. I would just like to understand under what conditions this problem is manifesting/how to reproduce it.

jbswetnam commented 6 years ago

You're right, it should work. As best I can tell, I'm using the version of clj-time specified in your project.clj ("0.13.0"). When I run lein deps :tree, the only reference to clj-time I see is from codax:

 [codax "1.2.0"]
   [clj-time "0.13.0"]
     [joda-time "2.9.7"]

I also tried putting the latest clj-time in my project.clj, and it still didn't work. Here's what happens in my REPL no matter which version I'm using:

user=> (require '[clj-time.format :as f])
nil
user=> (f/formatter :basic-date-time)

ClassCastException clojure.lang.Keyword cannot be cast to java.lang.String  clj-time.format/formatter (format.clj:41)

I guess I'll have to do some more investigation on my end.

Great library, BTW! I was looking for something like this.