bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #26361] NSCalendarDate %e format shows leading zeros


From: Doug Simons
Subject: [bug #26361] NSCalendarDate %e format shows leading zeros
Date: Mon, 27 Apr 2009 18:41:31 +0000
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_4_11; en) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1

URL:
  <http://savannah.gnu.org/bugs/?26361>

                 Summary: NSCalendarDate %e format shows leading zeros
                 Project: GNUstep
            Submitted by: theeggcamefirst
            Submitted on: Mon 27 Apr 2009 06:41:29 PM GMT
                Category: Base/Foundation
                Severity: 3 - Normal
              Item Group: Bug
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

Date formatting with %e is identical to %d (both show leading zero before
single-digit day of month). On Cocoa (and most other systems?) the %e format
shows a leading space rather than a 0.

It looks like the implementation of the %e format is just wrong. Here's a
patch that works for me:

Index: NSCalendarDate.m
===================================================================
--- NSCalendarDate.m    (revision 28244)
+++ NSCalendarDate.m    (working copy)
@@ -1967,16 +1967,15 @@
                v = info->dom;
                Grow(info, 2);
                v = v % 100;
-               if (v%10 == '0')
+               if (v < 10)
                  {
-                   info->t[info->offset+1] = ' ';
+                   info->t[info->offset+0] = ' ';
                  }
                else
                  {
-                   info->t[info->offset+1] = (v%10) + '0';
+                   info->t[info->offset+0] = (v/10) + '0';
                  }
-               v /= 10;
-               info->t[info->offset+0] = (v%10) + '0';
+               info->t[info->offset+1] = (v%10) + '0';
                info->offset += 2;
                break;
 






    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?26361>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]