X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=Koha%2FTemplate%2FPlugin%2FKohaDates.pm;h=134712f40c563ff74438af88d013de7fbff5407e;hb=82db730d71c0f96b2dbf5ec0f4321b2cf6045593;hp=a1bb40a38d6567168568480f2039001228198ba0;hpb=413a1e1e61b343db47b9b6fdecf3d981d87013ef;p=koha_fer diff --git a/Koha/Template/Plugin/KohaDates.pm b/Koha/Template/Plugin/KohaDates.pm index a1bb40a38d..134712f40c 100644 --- a/Koha/Template/Plugin/KohaDates.pm +++ b/Koha/Template/Plugin/KohaDates.pm @@ -17,20 +17,20 @@ package Koha::Template::Plugin::KohaDates; # with Koha; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -use strict; -use warnings; +use Modern::Perl; use Template::Plugin::Filter; use base qw( Template::Plugin::Filter ); -use warnings; -use strict; -use C4::Dates; +use Koha::DateUtils; +our $DYNAMIC = 1; sub filter { - my ($self,$text) = @_; - my $date = C4::Dates->new( $text, 'iso' ); - return $date->output("syspref"); + my ( $self, $text, $args, $config ) = @_; + return "" unless $text; + $config->{with_hours} //= 0; + my $dt = dt_from_string( $text, 'iso' ); + return output_pref({ dt => $dt, dateonly => !$config->{with_hours} }); } 1;