Uploaded image for project: 'ClojureScript'
  1. CLJS-564

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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Completed
    • Affects versions: None
    • Fix versions: 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

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              jonase Jonas Enlund
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: