NSDate bug?
NSDate bug?
- Subject: NSDate bug?
- From: Donald Hall <email@hidden>
- Date: Tue, 6 Aug 2002 00:40:12 -0600
The NSDate methods -earlierDate and -laterDate seem to be backwards.
According to the documentation the first is supposed to return the
earlier of the receiver and another date, the second is supposed to
return the later of the two dates.
Is this a known bug? Has anyone else run across this? Should I use a
different method to check if stopDate is before startDate?
Thanks for any advice,
Don
Here is my code fragment:
startDate = [NSCalendarDate dateWithString: startTimeString
calendarFormat:@"%I:%M %p"];
stopDate = [NSCalendarDate dateWithString: stopTimeString
calendarFormat:@"%I:%M %p"];
NSLog(@"windowShouldClose: startDate is %@, stopDate is %@",
startDate, stopDate);
NSLog(@"windowShouldClose: laterDate is %@, earlierDate is %@",
[stopDate laterDate:startDate], [stopDate earlierDate:startDate]);
// verify we are talking about the same day
NSLog(@"windowShouldClose: startDate is %d, stopDate is %d",
[startDate dayOfCommonEra], [stopDate dayOfCommonEra]);
2002-08-06 00:16:38.058 MyProg[367] windowShouldClose: startDate is
12:16 AM, stopDate is 11:16 AM
2002-08-06 00:16:38.059 MyProg[367] windowShouldClose: laterDate is
11:16 AM, earlierDate is 12:16 AM
2002-08-06 00:16:38.059 MyProg[367] windowShouldClose: startDate is
730851, stopDate is 730851
----------------------------------------------
Donald S. Hall, Ph.D.
Apps & More Software Design, Inc.
http://www.theboss.net/appsmore
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.