mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-01 00:13:37 +00:00
Test CPDate testInitWithString with a date prior to 1970.
This verifies that there are no problems with negative time intervals.
This commit is contained in:
+2
-2
@@ -167,7 +167,7 @@ var CPDateReferenceDate = new Date(Date.UTC(2001, 0, 1, 0, 0, 0, 0));
|
||||
|
||||
- (CPComparisonResult)compare:(CPDate)anotherDate
|
||||
{
|
||||
return (self > anotherDate) ? CPOrderedDescending : ((self < anotherDate) ? CPOrderedAscending : CPOrderedSame);
|
||||
return (self > anotherDate) ? CPOrderedDescending : ((self < anotherDate) ? CPOrderedAscending : CPOrderedSame);
|
||||
}
|
||||
|
||||
- (CPDate)earlierDate:(CPDate)anotherDate
|
||||
@@ -198,7 +198,7 @@ var CPDateReferenceDate = new Date(Date.UTC(2001, 0, 1, 0, 0, 0, 0));
|
||||
*/
|
||||
- (CPString)description
|
||||
{
|
||||
return [CPString stringWithFormat:@"%04d-%02d-%02d %02d:%02d:%02d %s", self.getFullYear(), self.getMonth()+1, self.getDate(), self.getHours(), self.getMinutes(), self.getSeconds(), [CPDate timezoneOffsetString:self.getTimezoneOffset()]];
|
||||
return [CPString stringWithFormat:@"%04d-%02d-%02d %02d:%02d:%02d %s", self.getFullYear(), self.getMonth() + 1, self.getDate(), self.getHours(), self.getMinutes(), self.getSeconds(), [CPDate timezoneOffsetString:self.getTimezoneOffset()]];
|
||||
}
|
||||
|
||||
- (id)copy
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
- (void)testInitWithString
|
||||
{
|
||||
var tests = [
|
||||
["1800-01-01 00:00:00 +0000", -5364662400],
|
||||
["1970-01-01 00:00:00 +0000", 0],
|
||||
["1970-01-01 00:01:00 +0000", 60],
|
||||
["1970-01-01 01:00:00 +0000", 60 * 60],
|
||||
|
||||
Reference in New Issue
Block a user