<< Back to previous view

[CLJS-564] Clojurescript reader can't read instant literals with some trailing components missing Created: 30/Jul/13  Updated: 04/Aug/13  Resolved: 04/Aug/13

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Jonas Enlund Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: None

Attachments: File CLJS-564.diff    


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]))
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

Comment by David Nolen [ 03/Aug/13 5:08 PM ]

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

Comment by Jonas Enlund [ 04/Aug/13 12:46 AM ]

This issue was addressed by CLJS-454

Generated at Fri Apr 26 00:52:22 CDT 2019 using JIRA 4.4#649-r158309.