clojure 2026-01-04

Happy new year everyone. I’m using some date-parsing code that chatgpt gave me some time ago which I think used to work. but after the new year started, it seems to fail. Can someone help me understand what’s happening. Here is the error I’m getting.

[:iso-string 2025-09-03T08:00:00+02:00 :now #object[java.time.Instant 0x4afbb6c2 2026-01-04T11:52:08.261119Z]]
Execution error (DateTimeParseException) at java.time.format.DateTimeFormatter/parseResolved0 (DateTimeFormatter.java:2046).
Text '2025-09-03T08:00:00+02:00' could not be parsed at index 19
Here is the code. it’s pretty simple.
(ns compute-grades
  (:import [ File]
           [java.time Instant]
           )
  (:require [clojure.string :refer [split starts-with? trim]]
            [clojure.pprint :refer [pprint]]
            [clojure.data.json :as json]
            [ :as io]
            [clojure.java.shell :refer [sh]])
  )

...

;; 
(defn future-date? [iso-string]
  (println [:iso-string iso-string :now (Instant/now)])
  (.isAfter (Instant/parse iso-string) (Instant/now)))

(defn past-date? [iso-string]
  (println [:iso-string iso-string :now (Instant/now)])
  (.isBefore (Instant/parse iso-string) (Instant/now)))

I suppose I could ask chatgpt what the problem is.

OK, chatgpt gave me a solution. I can try it.

The fix is:

;; 
(defn parse-iso->instant [s]
  (-> (OffsetDateTime/parse s)
      (.toInstant)))

(defn future-date? [iso-string]
  (.isAfter (parse-iso->instant iso-string) (Instant/now)))

(defn past-date? [iso-string]
  (.isBefore (parse-iso->instant iso-string) (Instant/now)))

I wonder why it worked last year. it’s bizare.

Perhaps the data was different?

Hello I am wondering what is the purpose/role of the $install_dir/deps.edn file that is referenced in clojure bash script, this value is currently used to compute the classpath cache, however it does not seemed to be involved when computing the classpath itself because tools.deps is using another deps.edn that is packaged as a resource inside the tools.deps jar (https://github.com/clojure/tools.deps/blob/master/src/main/resources/clojure/tools/deps/deps.edn) , am I overlooking something ?

Alex Miller (Clojure team) 2026-01-04T20:23:40.929369Z

It's not used but continues to be shipped as some older tools relied on its presence

thanks for the answer, do you remember the name of those older tools ?

Alex Miller (Clojure team) 2026-01-04T20:27:16.065679Z

the Datomic ion tooling was using a very old version of tools.deps that used it, but I think they have finally migrated off

Alex Miller (Clojure team) 2026-01-04T20:27:44.709769Z

I would say in the medium term it's likely to go away

👍 1

thank again for your very quick answer, really appreciated !