In my Actionscript code I have two dates:
var date1:Date = new Date(2011,1,1);
var date2:Date = new Date(2011,1,1);
This doesn't work:
var equal:Boolean = date1 == date2;
From reading I've found that this is a working alternative since it just gets the number of milliseconds from a standard point in time.
var equal:Boolean = date1.getTime() == date2.getTime();
So my questions are:
- Why doesn't the normal equality operator work on Dates in actionscript?
- ">" as well as "<" operators seem to work fine, but can they be trusted?
- Why would they work but not the equality operator?
- Is there a standard method I can use when comparing dates that just returns a -1, 0, or 1 (I realize I can easily create my own, but I would rather use an existing utility class)?
Thanks in advance.