[mochikit] Re: Comparing dates

2007-10-07 Thread Stan Rogers

More to the point here, Date() returns a string the way you are using
it, not a date object. If you want a date object to compare, use the
new keyword. (Date objects can be directly compared with ,  and =,
since they have a single scalar data member and collapse to a
milliseconds-after-epoch value on comparison.)

On Aug 28, 4:32 pm, Bob Ippolito [EMAIL PROTECTED] wrote:
 On 8/28/07, grum [EMAIL PROTECTED] wrote:





  Hi everyone,

  I'm having problems comparing the following:

  isoTimestamp(2007-08-13T04:00:00+00:00)

  which gives me:

  Mon Aug 13 2007 00:00:00 GMT-0400 (EDT)

  and:

  Date()

  which (right now) gives me:

  Tue Aug 28 2007 16:14:12 GMT-0400 (EDT)

  ie. isoTimestamp(2007-08-13T04:00:00+00:00)  Date() is returning
  false.

  I think it's something to do with the lack of quotes around the result
  of isoTimestamp - though quite what that means i'm not sure.  Please
  someone help me out, i really need to be able to compare these dates.

 JavaScript's built-in comparison operators are no good for comparing
 objects, only strings and numbers. This is why MochiKit.Base.compare
 exists.

 -bob


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~--~~~~--~~--~--~---



[mochikit] Re: Comparing dates

2007-08-28 Thread Bob Ippolito

On 8/28/07, grum [EMAIL PROTECTED] wrote:

 Hi everyone,

 I'm having problems comparing the following:

 isoTimestamp(2007-08-13T04:00:00+00:00)

 which gives me:

 Mon Aug 13 2007 00:00:00 GMT-0400 (EDT)

 and:

 Date()

 which (right now) gives me:

 Tue Aug 28 2007 16:14:12 GMT-0400 (EDT)

 ie. isoTimestamp(2007-08-13T04:00:00+00:00)  Date() is returning
 false.

 I think it's something to do with the lack of quotes around the result
 of isoTimestamp - though quite what that means i'm not sure.  Please
 someone help me out, i really need to be able to compare these dates.

JavaScript's built-in comparison operators are no good for comparing
objects, only strings and numbers. This is why MochiKit.Base.compare
exists.

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~--~~~~--~~--~--~---