Well, it depends how the comparisons work. When you check equivalence "==" it is checking whether the two Date instances are the same object, which of course they aren't. When you check greater than or less than, it can only check their value, and that is the same.

So it comes down to how the Date class handles comparisons. I'm honestly not sure how you overwrite these in Actionscript (I guess there must be something in Object that you can overwrite). But checking equivalence with complex variables will always be checking if they are actually references to the same object, not if the two objects have the same attributes.

Oh, and Ryan, is your fourth line meant to be

trace( d1 = d2 );

or

trace( d1 == d2 );

?

Regards,
Grant Cox

Ryan Matsikas wrote:

var d1:Date = new Date( 1970, 0 );
var d2:Date = new Date( 1970, 0 );
trace( d1.toString() == d2.toString() ); // true
trace( d1 = d2 ); // Thu Jan 1 00:00:00 GMT-0700 1970

On 3/23/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Don't know why I haven't come across this before, but can anyone confirm
this for me (and maybe give an explanation)?

<code>
var d1:Date = new Date( 1970, 0 );
var d2:Date = new Date( 1970, 0 );
trace( d1 == d2 ); // false
trace( d1 <= d2 ); // true
trace( d1 >= d2 ); // TRUE?!
</code>

Umm… If something is both >= *and* <= the only possibly is that it is
equal. So… WTF?


dave myron
principal, technical director

contentfree
⊡ 206.855.5580 phone | 206.774.2767 fax
⊠ [EMAIL PROTECTED]
⊟ 337 1st ave ne. suite 100, issaquah, wa 98027


_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

------------------------------------------------------------------------

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

------------------------------------------------------------------------

No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.3.0/290 - Release Date: 3/23/2006
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to