andrewmcveigh / cljs-time

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

Uncaught TypeError: Cannot read property 'Date' of undefined -> goog.date.Date in coerce.cljs #52

Closed sergium closed 8 years ago

sergium commented 8 years ago

trying to use version: "0.3.14"

getting following error in the js-console:

Uncaught TypeError: Cannot read property 'Date' of undefined (anonymous function) @ coerce.cljs:94

  goog.date.Date
  (to-date-time [local-date]
    (when local-date (doto (goog.date.UtcDateTime.) (.set local-date))))
andrewmcveigh commented 8 years ago

Hey,

Any chance you're using lein-figwheel <= 0.4.0?

Could you perhaps give me a code snippet of what you're trying to call that's failing?

sergium commented 8 years ago

Hi,

I'm using [lein-figwheel "0.4.1"]

Here the only function I'm using:


 (:require 
            [cljs-time.core   :as time-core]
            [cljs-time.coerce :as time-coerce]
            [cljs-time.format :as time-format])

(defn timestamp->str [timestamp]
  (time-format/unparse (time-format/formatter "yyyy-MM-dd HH:mm:ss")
                       (-> timestamp
                         (/ 1000)
                         (time-coerce/from-long))))
sergium commented 8 years ago

Follow up.

Actually for me lib works well, I'm getting this error ONCE on first loading - I'm not using goog.date.Date.

So - it's just 'not that nice'...

andrewmcveigh commented 8 years ago

So, I've not seen this before. I've seen similar things with lein-figwheel, so let me investigate a bit. I'll try to reproduce.

sergium commented 8 years ago

Ok, sure.

And thanks for rapid response!

If you need any help - just let me know.

andrewmcveigh commented 8 years ago

If you could provide (as much as possible) of your project.clj that would be great!

sergium commented 8 years ago

Ok, I'll create min-example project.

sergium commented 8 years ago

weird...

can't reproduce it in the clean project - looks like I've messed up with figwheel's config in my dev\prod setup

sorry for the mess - I think we can close issue

when(if) I reproduce it - I will open new issue with the link to a git project where you can get the complete environment

andrewmcveigh commented 8 years ago

Closing this. If you still have the issue/can reproduce, please re-open.