bugGNUstep - Bugs: bug #12330, NSCalendarDate has arbitrary year...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #12330: NSCalendarDate has arbitrary year limit that makes it unable to read its own output

Submitted by:  None
Submitted on:  Tue 15 Mar 2005 03:21:25 PM UTC  
 
Category: Base/FoundationSeverity: 3 - Normal
Item Group: BugStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

Tue 15 Mar 2005 04:42:18 PM UTC, comment #2:

Fixed in CVS.
I also 'corrected' distant past/future to match MacOS-X
Patch too old to be of use ... but thanks anyway.

Richard Frith-Macdonald <CaS>
Project Member
Tue 15 Mar 2005 03:26:52 PM UTC, comment #1:

For some reason bugzilla didn't record my identity, even though I'm sure I was logged in. Anyway, this bug was submitted by lcampbel at akamai.com.

Anonymous
Tue 15 Mar 2005 03:21:25 PM UTC, original submission:

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

Anonymous

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

Follow 2 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Tue 15 Mar 2005 04:42:18 PM UTCCaSStatusNone=>Fixed
  Open/ClosedOpen=>Closed

Back to the top


Powered by Savane 3.1-cleanup1