From c60113bfbed953dfe31a76cbdb96194636ebd165 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 20 Feb 2015 10:27:00 -0500 Subject: [PATCH] [SIGNED OFF] Bug 13739 - KohaDates should display hours if they exists by default unless specified There are many parts of Koha that are now hiding hours by default. This is rarely helpful. KohaDates should display hours by default unless the time is 23:59, in which case the hours should be not be displayed. Test Plan: 1) Check out two items, one due at at an hour, one not 2) View the patron's circ history, note you don't see the hours 3) Apply this patch 4) View the circ history again, note the hours are listed for date/time where the time is not 23:59. Signed-off-by: Jesse Maseto --- Koha/Template/Plugin/KohaDates.pm | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Koha/Template/Plugin/KohaDates.pm b/Koha/Template/Plugin/KohaDates.pm index 711255a..54b8721 100644 --- a/Koha/Template/Plugin/KohaDates.pm +++ b/Koha/Template/Plugin/KohaDates.pm @@ -28,13 +28,15 @@ our $DYNAMIC = 1; sub filter { my ( $self, $text, $args, $config ) = @_; return "" unless $text; - $config->{with_hours} //= 0; my $dt = dt_from_string( $text, 'iso' ); - return $config->{as_due_date} ? - output_pref({ dt => $dt, as_due_date => 1 }) : - output_pref({ dt => $dt, dateonly => !$config->{with_hours} }); + my $params; + $params->{dt} = $dt; + $params->{dateonly} = 1 if ( defined $config->{with_hours} && $config->{with_hours} == 0 ); + $params->{as_due_date} = 1 unless ( $params->{dateonly} ); + + return output_pref( $params ); } 1; -- 1.7.2.5