Bug in NSCalendarDate?
Bug in NSCalendarDate?
- Subject: Bug in NSCalendarDate?
- From: Pat Homelvig <email@hidden>
- Date: Mon, 3 May 2004 09:33:09 -0600
*This message was transferred with a trial version of CommuniGate(tm) Pro*
Wanted to check to see if this is a known bug in NSCaledarDate before I
file a bug.
Using the method:
[NSCalendarDate dateWithYear:2004 month:0 day:ii hour:0 minute:0
second:0 timeZone:[NSTimeZone localTimeZone]]
returns date=2004-05-06 00:00:00 -0600 when ii = 127
returns date=2003-08-25 00:00:00 -0600 when ii = 128
Has the same problem if the year is 2003. Almost looks like the day
value is cast to a char instead of an int internally.
Am I missing something?
Example used:
#######################
#import <Foundation/Foundation.h>
int main()
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
unsigned ii;
char si;
for(ii = 1; ii <= 366; ii++) {
si = ii;
NSCalendarDate *date = [NSCalendarDate dateWithYear:2004
month:0 day:ii
hour:0 minute:0 second:0 timeZone:[NSTimeZone
localTimeZone]];
NSLog(@"ii = %d (%d), date=%@", ii, si, [date description]);
}
[pool release];
return 0;
}
#######################
Results:
2004-05-03 09:29:10.737 DateTest[5191] ii = 125 (125), date=2004-05-04
00:00:00 -0600
2004-05-03 09:29:10.737 DateTest[5191] ii = 126 (126), date=2004-05-05
00:00:00 -0600
2004-05-03 09:29:10.738 DateTest[5191] ii = 127 (127), date=2004-05-06
00:00:00 -0600
2004-05-03 09:29:10.738 DateTest[5191] ii = 128 (-128), date=2003-08-25
00:00:00 -0600
2004-05-03 09:29:10.738 DateTest[5191] ii = 129 (-127), date=2003-08-26
00:00:00 -0600
2004-05-03 09:29:10.742 DateTest[5191] ii = 130 (-126), date=2003-08-27
00:00:00 -0600
....
2004-05-03 09:29:10.881 DateTest[5191] ii = 252 (-4), date=2003-12-27
00:00:00 -0700
2004-05-03 09:29:10.882 DateTest[5191] ii = 253 (-3), date=2003-12-28
00:00:00 -0700
2004-05-03 09:29:10.882 DateTest[5191] ii = 254 (-2), date=2003-12-29
00:00:00 -0700
2004-05-03 09:29:10.883 DateTest[5191] ii = 255 (-1), date=2003-12-30
00:00:00 -0700
2004-05-03 09:29:10.883 DateTest[5191] ii = 256 (0), date=2003-12-31
00:00:00 -0700
2004-05-03 09:29:10.883 DateTest[5191] ii = 257 (1), date=2004-01-01
00:00:00 -0700
2004-05-03 09:29:10.883 DateTest[5191] ii = 258 (2), date=2004-01-02
00:00:00 -0700
2004-05-03 09:29:10.887 DateTest[5191] ii = 259 (3), date=2004-01-03
00:00:00 -0700
Pat Homelvig
White Wolf Software, Inc.
303-906-6104
mailto:email@hidden
http://www.whitewolf.com
_______________________________________________
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.