Hi,

I'm trying to compare dates with ClojureScript like this:

(ns common
  (:require [goog.date.Date]))
. . .
(goog.date.Date/compare (js/Date.) (js/Date.))

But it fails with the following error:

"Error evaluating:" (goog.date.Date/compare (js/Date.) (js/Date.)) :as 
"goog.date.Date.compare((new Date()),(new Date()));\n"
#<TypeError: Object function (opt_year, opt_month, opt_date) {
  if(goog.isNumber(opt_year)) {
    this.date_ = new Date(opt_year, opt_month || 0, opt_date || 1);
    this.maybeFixDst_(opt_date || 1)
  }else {
    if(goog.isObject(opt_year)) {
      this.date_ = new Date(opt_year.getFullYear(), opt_year.getMonth(), 
opt_year.getDate());
      this.maybeFixDst_(opt_year.getDate())
    }else {
      this.date_ = new Date(goog.now());
      this.date_.setHours(0);
      this.date_.setMinutes(0);
      this.date_.setSeconds(0);
      this.date_.setMilliseconds(0)
    }
  }
} has no method 'compare'>
TypeError: Object function (opt_year, opt_month, opt_date) {
  if(goog.isNumber(opt_year)) {
    this.date_ = new Date(opt_year, opt_month || 0, opt_date || 1);
    this.maybeFixDst_(opt_date || 1)
  }else {
    if(goog.isObject(opt_year)) {
      this.date_ = new Date(opt_year.getFullYear(), opt_year.getMonth(), 
opt_year.getDate());
      this.maybeFixDst_(opt_year.getDate())
    }else {
      this.date_ = new Date(goog.now());
      this.date_.setHours(0);
      this.date_.setMinutes(0);
      this.date_.setSeconds(0);
      this.date_.setMilliseconds(0)
    }
  }
} has no method 'compare'
    at eval at <anonymous> (http://localhost:8080/js/main.js:33158:147)
    at eval at <anonymous> (http://localhost:8080/js/main.js:33158:147)
    at http://localhost:8080/js/main.js:33158:142
    at evaluate_javascript (http://localhost:8080/js/main.js:33171:4)
    at Object.callback (http://localhost:8080/js/main.js:33236:139)
    at [object Object].deliver (http://localhost:8080/js/main.js:31478:13)
    at [object Object].deliver_ (http://localhost:8080/js/main.js:32594:14)
    at Function.messageReceived_ (http://localhost:8080/js/main.js:32188:13)
    at [object Object].handleEvent 
(http://localhost:8080/js/main.js:22504:26)
    at Object.fireListener (http://localhost:8080/js/main.js:23003:21)
nil

What I'm doing wrong?

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to