summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2007-05-19 02:30:27 +0000
committertetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46>2007-05-19 02:30:27 +0000
commite33fc077fbd42837839c9cae81a2f569e38f4d7f (patch)
tree593a2444cf9f4a10d8fb2ec787167eb2af661ed7
parentc551bc6e662d3ba7d5ab917d78feb7fec15bc74b (diff)
Fix for longformat of '' and tests
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1214 4979c152-3d1c-0410-bac9-87ea11338e46
-rw-r--r--LedgerSMB/Locale.pm4
-rw-r--r--t/03-date-handling.t9
2 files changed, 11 insertions, 2 deletions
diff --git a/LedgerSMB/Locale.pm b/LedgerSMB/Locale.pm
index 84c1ed13..8773cb56 100644
--- a/LedgerSMB/Locale.pm
+++ b/LedgerSMB/Locale.pm
@@ -90,8 +90,8 @@ sub text {
sub date {
my ( $self, $myconfig, $date, $longformat ) = @_;
-## my @longmonth = (qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec));
- my @longmonth = (
+ my @longmonth = (qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec));
+ @longmonth = (
"January", "February", "March", "April",
"May ", "June", "July", "August",
"September", "October", "November", "December"
diff --git a/t/03-date-handling.t b/t/03-date-handling.t
index 2f9c1a06..73686cc7 100644
--- a/t/03-date-handling.t
+++ b/t/03-date-handling.t
@@ -35,6 +35,9 @@ my @formats = ( ['mm-dd-yy', '-', 2, '02-29-00', '03-01-00'],
my @months = ('January', 'February', 'March', 'April', 'May ', 'June',
'July', 'August', 'September', 'October', 'November', 'December');
+my @mon = ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
+ 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
+
my %month_num = ('01' => '31', '02' => '28', '03' => '31', '04' => '30',
'05' => '31', '06' => '30', '07' => '31', '08' => '31',
'09' => '30', '10' => '31', '11' => '30', '12' => '31');
@@ -73,6 +76,7 @@ foreach my $format (0 .. $#formats) {
my $start = $fmt;
my $temp = sprintf('%02d', $mm);
my $month_en = $locale_en->text($months[$mm - 1]);
+ my $month_en_2 = $locale_en->text($mon[$mm - 1]);
my $month_es = $locale_es->text($months[$mm - 1]);
$start =~ s/dd/29/;
$start =~ s/yyyy/2000/;
@@ -82,7 +86,12 @@ foreach my $format (0 .. $#formats) {
"$month_es 29 2000", "date, $start, $fmt: long, es");
cmp_ok($locale_en->date(\%myconfig, $start, 1), 'eq',
"$month_en 29 2000", "date, $start, $fmt: long, en");
+ cmp_ok($locale_en->date(\%myconfig, $start, ''), 'eq',
+ "$month_en_2 29 2000", "date, $start, $fmt: '', en") if
+ $start !~ /^\d{4}\D/; # Ack... special case
}
+ cmp_ok($locale_en->date(\%myconfig, '2007-05-18', ''), 'eq',
+ "2007-05-18", "date, 2007-05-18, $fmt: '', en");
}
# $form->current_date checks