Bug 14950: Fix day formatting if < 10

$dt->day return a single digit if < 10, we want to display it on 2
digits

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
This commit is contained in:
Jonathan Druart 2015-10-15 13:50:44 +01:00 committed by Chris Cormack
parent bf64bd49d8
commit c141b2ed90
1 changed files with 5 additions and 7 deletions

View File

@ -332,13 +332,11 @@ foreach my $tag (sort keys %{$tagslib}) {
if ( !$value && $use_default_values) {
$value = $tagslib->{$tag}->{$subfield}->{defaultvalue};
# get today date & replace YYYY, MM, DD if provided in the default value
my $today = dt_from_string;
my $year = $today->year;
my $month = $today->month;
my $day = $today->day;
$value =~ s/YYYY/$year/g;
$value =~ s/MM/$month/g;
$value =~ s/DD/$day/g;
my $today_iso = output_pref( { dt=>dt_from_string, dateonly => 1, dateformat => 'iso' } );
my ( $year, $month, $day ) = split ('-', $today_iso);
$value =~ s/YYYY/$year/g;
$value =~ s/MM/$month/g;
$value =~ s/DD/$day/g;
}
$subfield_data{visibility} = "display:none;" if (($tagslib->{$tag}->{$subfield}->{hidden} > 4) || ($tagslib->{$tag}->{$subfield}->{hidden} < -4));
# testing branch value if IndependentBranches.