diff options
author | tetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-05-19 02:30:01 +0000 |
---|---|---|
committer | tetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-05-19 02:30:01 +0000 |
commit | 1738eacbdfaf500f38ac4c544bb9f578e77cbb38 (patch) | |
tree | 6601f8eadfe29262ddc764ac2140e8d3e5e3a67b | |
parent | 2c7f9b4bd8b54c175d3e59072ce6a8d4b3d1cacf (diff) |
Fix for longformat of '' and tests
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/branches/1.2@1213 4979c152-3d1c-0410-bac9-87ea11338e46
-rw-r--r-- | LedgerSMB/Locale.pm | 4 | ||||
-rw-r--r-- | t/03-date-handling.t | 8 |
2 files changed, 10 insertions, 2 deletions
diff --git a/LedgerSMB/Locale.pm b/LedgerSMB/Locale.pm index 8e1d2e9f..e9fe32c6 100644 --- a/LedgerSMB/Locale.pm +++ b/LedgerSMB/Locale.pm @@ -84,8 +84,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 be252e9d..c2e009ac 100644 --- a/t/03-date-handling.t +++ b/t/03-date-handling.t @@ -30,6 +30,8 @@ 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', @@ -69,6 +71,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/; @@ -78,7 +81,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 |