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/



_______________________________________________
Bug-gnustep mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-gnustep

Reply via email to