mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
fix a date padding problem
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@1269 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
560ce9f667
commit
bd908d67fc
@ -35,6 +35,7 @@
|
||||
#include "config.h"
|
||||
#include "date.h"
|
||||
|
||||
/* hack alert -- this should be turned into user-configurable parameter .. */
|
||||
DateFormat dateFormat = DATE_FORMAT_US;
|
||||
|
||||
/********************************************************************\
|
||||
@ -58,20 +59,29 @@ DateFormat dateFormat = DATE_FORMAT_US;
|
||||
void
|
||||
printDate (char * buff, int day, int month, int year)
|
||||
{
|
||||
|
||||
/* Note that when printing year, we use %-4d in format string;
|
||||
* this causes a one, two or three-digit year to be left-adjusted
|
||||
* when printed (i.e. padded with blanks on the right). This is
|
||||
* important while the user is editing the year, since erasing a
|
||||
* digit can temporarily cause a three-digit year, and having the
|
||||
* blank on the left is a real pain for the user. So pad on the
|
||||
* right.
|
||||
*/
|
||||
switch(dateFormat)
|
||||
{
|
||||
case DATE_FORMAT_UK:
|
||||
sprintf (buff, "%2d/%2d/%4d", day, month, year);
|
||||
sprintf (buff, "%2d/%2d/%-4d", day, month, year);
|
||||
break;
|
||||
case DATE_FORMAT_CE:
|
||||
sprintf (buff, "%2d.%2d.%4d", day, month, year);
|
||||
sprintf (buff, "%2d.%2d.%-4d", day, month, year);
|
||||
break;
|
||||
case DATE_FORMAT_ISO:
|
||||
sprintf (buff, "%04d-%02d-%02d", year, month, day);
|
||||
break;
|
||||
case DATE_FORMAT_US:
|
||||
default:
|
||||
sprintf (buff, "%2d/%2d/%4d", month, day, year);
|
||||
sprintf (buff, "%2d/%2d/%-4d", month, day, year);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user