andrewmcveigh / cljs-time

A clj-time inspired date library for clojurescript.
342 stars 57 forks source link

parse fails for simple formats yyyy-MM-dd #64

Closed publicmayhem closed 8 years ago

publicmayhem commented 8 years ago

Below is a rhino-repl example, but I also get this in chrome

$ lein trampoline cljsbuild repl-rhino Running Rhino-based ClojureScript REPL. To quit, type: :cljs/quit cljs.user=> (require '[cljs-time.format :as fmt]) nil cljs.user=> (def yyyy-MM-dd (fmt/formatter "yyyy-MM-dd"))

'cljs.user/yyyy-MM-dd

cljs.user=> (fmt/parse yyyy-MM-dd "2013-04-01") org.mozilla.javascript.JavaScriptException: #error {:message "The parser could not match the input string.", :data {:type :parser-no-match}} (.cljs_rhino_repl/goog/../cljs_time/format.js#565) cljs_time$format$parseSTAR (.cljs_rhino_repl/cljs_time/format.cljs:397:9) (.cljs_rhino_repl/cljs_time/format.cljs:405:6) cljs_time$format$parse (.cljs_rhino_repl/cljs_time/format.cljs:401:1) (NO_SOURCE_FILE :1:0) (NO_SOURCE_FILE :1:0)

gdulus commented 8 years ago

The same here

(log/info (f/parse (f/formatter "yyyyMMdd") "20100311"))

gives

Uncaught #error {:message "The parser could not match the input string.", :data {:type :parser-no-match}}cljs_time$format$parseSTAR @ format.cljs?rel=1463408247474:397cljs_time.format.parse.cljs$core$IFn$_invoke$arity$2 @ format.cljs?rel=1463408247474:405cljs_time$format$parse @ format.cljs?rel=1463408247474:401(anonymous function) @ handlers.cljs?rel=1463861354433:26 logger.cljs?rel=1463858293035:5 Registering route :empty -> /

yogthos commented 8 years ago

Just ran into the same issue as well, is there any news regarding this?

yogthos commented 8 years ago

It appears to be failing with recent versions of ClojureScript in my setup. I rolled back to 1.7.10 and everything seems fine.

andrewmcveigh commented 8 years ago

Hey, sorry for the lack of update on this...

I'm not hitting this issue with the latest clojurescript [org.clojure/clojurescript "1.9.89"]. Is this still an issue for you?

boot.user=> (rhino-repl)
To quit, type: :cljs/quit
cljs.user=>  (require '[cljs-time.format :as fmt])
nil
cljs.user=> (def yyyy-MM-dd (fmt/formatter "yyyy-MM-dd"))
#'cljs.user/yyyy-MM-dd
cljs.user=> (fmt/parse yyyy-MM-dd "2013-04-01")
#object[Object 20130401T000000]
yogthos commented 8 years ago

Just tested with the latest and seems to be working here as well. It looks like there might be some other dependency in my project that's conflicting. In any case, I don't think that's an issue with cljs-time.

publicmayhem commented 8 years ago

Thx, this seems to be working for me as well with the latest version of clojurescript