dm3/clojure.java-time

Support specifying case-sensitivity in formatter

shaolang opened this issue · 3 comments

Running the following in JDK11 returns the local time correctly:

(def fmt (java-time/formatter "hh:mma"))
(java-time/local-time fmt "12:34AM")

But JDK14 throws an exception Text '12:34AM' could not be parsed at index 5.

java.time.DateTimeFormatterBuilder has two methods parseCaseSensitive and parseCaseInsensitive. Option map for formatter could be extended to accept another key :case with values :sensitive or :insensitive.

If that's acceptable, I can submit a pull request to implement this.

dm3 commented

Sure, that would be great!

Which of the following would you prefer for the option map?

  1. :case :insensitive (and default is :sensitive)
  2. :insensitive true (and default is false)
  3. :sensitive false (and default is true)
dm3 commented

I think :case (:sensitive|:insensitive) would be best.