diff --git a/Foundation/CPDate.j b/Foundation/CPDate.j index bd86a42f1..86bf25deb 100644 --- a/Foundation/CPDate.j +++ b/Foundation/CPDate.j @@ -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 diff --git a/Tests/Foundation/CPDateTest.j b/Tests/Foundation/CPDateTest.j index 343d2227a..d719eee85 100644 --- a/Tests/Foundation/CPDateTest.j +++ b/Tests/Foundation/CPDateTest.j @@ -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],