Match CPDate distantPast and distantFuture with Cocoa.

This commit is contained in:
Alexander Ljungberg committed 2012-06-02 13:17:34 -07:00
1 parent 25763962b2
commit d0c7796e7c
2 files changed
+12 -2

No files matched your search

+2 -2
View File
@@ -64,12 +64,12 @@ var CPDateReferenceDate = new Date(Date.UTC(2001, 0, 1, 0, 0, 0, 0));
+ (id)distantPast
{
return new Date(-10000, 1, 1, 0, 0, 0, 0);
return [CPDate dateWithTimeIntervalSinceReferenceDate:-63113817600.0];
}
+ (id)distantFuture
{
return new Date(10000, 1, 1, 0, 0, 0, 0);
return [CPDate dateWithTimeIntervalSinceReferenceDate:63113990400.0];
}
- (id)initWithTimeIntervalSinceNow:(CPTimeInterval)seconds
+10
View File
@@ -10,6 +10,16 @@
[self assertTrue:[unixDate isEqualToDate:cocoaDate] message:[unixDate description] + " isEqualToDate: " + [cocoaDate description]];
}
- (void)testDistantPast
{
[self assert:[CPDate dateWithTimeIntervalSinceReferenceDate:-63113817600.0] equals:[CPDate distantPast]];
}
- (void)testDistantFuture
{
[self assert:[CPDate dateWithTimeIntervalSinceReferenceDate:63113990400.0] equals:[CPDate distantFuture]];
}
- (void)testDate
{
var before = new Date(),