Bugzilla – Attachment 82880 Details for
Bug 21824
Add ability to format dates in various formats in templates
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21824: Add KohaDates method 'output_preference' to make it easy to store formatted dates in TT variable
Bug-21824-Add-KohaDates-method-outputpreference-to.patch (text/plain), 1.85 KB, created by
Owen Leonard
on 2018-12-05 16:54:51 UTC
(
hide
)
Description:
Bug 21824: Add KohaDates method 'output_preference' to make it easy to store formatted dates in TT variable
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2018-12-05 16:54:51 UTC
Size:
1.85 KB
patch
obsolete
>From 61bb34bfae330bad4ebfad9bae2653b85f43af71 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Tue, 13 Nov 2018 12:36:17 -0500 >Subject: [PATCH] Bug 21824: Add KohaDates method 'output_preference' to make > it easy to store formatted dates in TT variable > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >--- > Koha/Template/Plugin/KohaDates.pm | 5 +++++ > t/db_dependent/Template/Plugin/KohaDates.t | 6 +++++- > 2 files changed, 10 insertions(+), 1 deletion(-) > >diff --git a/Koha/Template/Plugin/KohaDates.pm b/Koha/Template/Plugin/KohaDates.pm >index 13ebec8..e87d478 100644 >--- a/Koha/Template/Plugin/KohaDates.pm >+++ b/Koha/Template/Plugin/KohaDates.pm >@@ -37,4 +37,9 @@ sub filter { > output_pref({ dt => $dt, dateonly => !$config->{with_hours}, dateformat => $config->{dateformat} }); > } > >+sub output_preference { >+ my ( $self, @params ) = @_; >+ return output_pref( @params ); >+} >+ > 1; >diff --git a/t/db_dependent/Template/Plugin/KohaDates.t b/t/db_dependent/Template/Plugin/KohaDates.t >index 36857a6..53449d8 100644 >--- a/t/db_dependent/Template/Plugin/KohaDates.t >+++ b/t/db_dependent/Template/Plugin/KohaDates.t >@@ -1,10 +1,12 @@ > #!/usr/bin/perl > > use Modern::Perl; >+ > use C4::Context; > use Koha::DateUtils; >-use Test::More tests => 8; >+ > use Test::MockModule; >+use Test::More tests => 9; > use t::lib::Mocks; > > BEGIN { >@@ -51,6 +53,8 @@ is( $filtered_date, '01/04/1979', 'us: dt_from_string should return the valid da > $filtered_date = $filter->filter('1979-04-01', undef, { dateformat => 'iso' } ); > is( $filtered_date, '1979-04-01', 'date should be returned in ISO if dateformat is passed with a value of iso' ); > >+is( Koha::DateUtils::output_pref( dt_from_string ), $filter->output_preference( dt_from_string ), 'Filter output_preference method output matches output_pref' ); >+ > $module_context->mock( > 'tz', > sub { >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 21824
:
82308
|
82316
|
82879
|
82880
|
83188
|
91354
|
91355
|
91356
|
91357
|
91358
|
91363
|
91364
|
94920
|
94921
|
94922