ClojureScript

Clojurescript reader can't read instant literals with some trailing components missing

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

According to clojure.instant[1] the reader should be able to elide trailing components when readin instant literals. The following are all read as the same date by the clojure reader:

#inst "2013"
#inst "2013-01"
#inst "2013-01-01"
#inst "2013-01-01T00"
...
#inst "2013-01-01T00:00:00.000-00:00"

Only the last ones returns a valid date with the clojurescript reader:

ClojureScript:cljs.user> (ns cljs.user (:require [cljs.reader :as r]))
nil
ClojureScript:cljs.user> (r/read-string "#inst \"2009\"")
#inst "NaN-NaN-NaNTNaN:NaN:NaN.NaN-00:00"
ClojureScript:cljs.user> (r/read-string "#inst \"2013-01-01T00:00:00.000-00:00\"")
#inst "2013-01-01T00:00:00.000-00:00"

[1] https://github.com/clojure/clojure/blob/b62df08fc3567d17cca68acfaa96adba2880126d/src/clj/clojure/instant.clj#L92

Activity

Hide
Jonas Enlund added a comment -

This issue was addressed by CLJS-454

Show
Jonas Enlund added a comment - This issue was addressed by CLJS-454
Hide
David Nolen added a comment -

Is this a different issue than the one addressed by the other reader patch?

Show
David Nolen added a comment - Is this a different issue than the one addressed by the other reader patch?

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: