Bugzilla – Attachment 94921 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.98 KB, created by
Martin Renvoize (ashimema)
on 2019-10-31 16:40:57 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:
Martin Renvoize (ashimema)
Created:
2019-10-31 16:40:57 UTC
Size:
1.98 KB
patch
obsolete
>From 35d4927fc416740f5ab9ecdea58b797fdfeeb6cf 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> >Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > 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 13ebec8926..e87d478adc 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 36857a65dd..53449d8795 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.20.1
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