URL:
<http://savannah.gnu.org/bugs/?func=detailitem&item_id=12330>
Summary: NSCalendarDate has arbitrary year limit that makes
it unable to read its own output
Project: GNUstep
Submitted by: None
Submitted on: Tue 03/15/2005 at 10:21
Category: Base/Foundation
Severity: 5 - Average
Item Group: Bug
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
_______________________________________________________
Details:
For some reason NSCalendarDate formats limit the year to the range (0, 9999).
I see no reason for this, and in fact it means that NSCalendarDate can't parse
its own output for +[NSDate distantPast] and +[NSDate distantFuture].
Here's the fix (based on gnustep 1.8.0):
====
//projects/shared/gnustep-base-1.8.0.1/akamai/gnustep-base/Source/NSCalendarDate.m#2
- /u0/lcampbel/nbuild/akamai/gnustep-base/Source/NSCalendarDate.m ====
@@ -1027,7 +1027,7 @@
break;
case 'Y':
- sourceIdx += getDigits(&source[sourceIdx], tmpStr, 4);
+ sourceIdx += getDigits(&source[sourceIdx], tmpStr, 6);
year = atoi(tmpStr);
had |= hadY;
break;
@@ -1610,7 +1610,7 @@
* %y year as a decimal number without century (minimum 0)
* </item>
* <item>
- * %Y year as a decimal number with century, minimum 0, maximum 9999
+ * %Y year as a decimal number with century
* </item>
* <item>
* %z time zone offset (HHMM)
@@ -1675,10 +1675,6 @@
ycent = YES;
case 'y':
++i;
- if (yd < 0)
- yd = 0;
- if (yd > 9999)
- yd = 9999;
if (ycent)
k = VSPRINTF_LENGTH(sprintf(&(buf[j]), "%04d", yd));
else
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?func=detailitem&item_id=12330>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
_______________________________________________
Bug-gnustep mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-gnustep