mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-22 14:35:52 +00:00
Fixed: CPDates compared equal to nil and CPNull.
This commit is contained in:
1 parent
94ce055bc2
commit
f89c2e0ba9
2 files changed
+9
-1
No files matched your search
+1
-1
@@ -153,7 +153,7 @@ var CPDateReferenceDate = new Date(Date.UTC(2001,1,1,0,0,0,0));
|
||||
|
||||
- (BOOL)isEqualToDate:(CPDate)anotherDate
|
||||
{
|
||||
return !(self < anotherDate || self > anotherDate);
|
||||
return self === anotherDate || (anotherDate !== nil && anotherDate.isa && [anotherDate isKindOfClass:CPDate] && !(self < anotherDate || self > anotherDate));
|
||||
}
|
||||
|
||||
- (CPComparisonResult)compare:(CPDate)anotherDate
|
||||
|
||||
@@ -25,6 +25,14 @@
|
||||
[self assert:middle equals:[middle laterDate:past] message:"laterDate incorrect"];
|
||||
}
|
||||
|
||||
- (void)testEquals
|
||||
{
|
||||
var now = [CPDate date];
|
||||
[self assert:now equals:now];
|
||||
[self assertFalse:[now isEqual:[CPNull null]]];
|
||||
[self assertFalse:[now isEqual:nil]];
|
||||
}
|
||||
|
||||
- (void)testInitWithString
|
||||
{
|
||||
var tests = [
|
||||
|
||||
Reference in new issue
Block a user