We're updating the issue view to help you get more done. 

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

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:

1 2 3 4 5 6 #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:

1 2 3 4 5 6 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

Environment

None

Status

Assignee

Unassigned

Reporter

Jonas Enlund

Labels

None

Approval

None

Patch

None

Priority

Major