Bugzilla – Attachment 84587 Details for
Bug 19816
output_pref must implement 'dateonly' for dateformat => rfc3339
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19816: Implement dateonly for rfc3339 format
Bug-19816-Implement-dateonly-for-rfc3339-format.patch (text/plain), 1.63 KB, created by
Martin Renvoize (ashimema)
on 2019-01-31 15:47:38 UTC
(
hide
)
Description:
Bug 19816: Implement dateonly for rfc3339 format
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2019-01-31 15:47:38 UTC
Size:
1.63 KB
patch
obsolete
>From 84f768c1fbd2c8e3ec03d7e9c06662255104a49a Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 24 Jan 2019 14:29:09 -0300 >Subject: [PATCH] Bug 19816: Implement dateonly for rfc3339 format > >This patch implements the dateonly option for the rfc3339. This is >described in the OpenAPI 2.0 specification [1]. The required output >format is described on RFC 3339 [2], as 'full-date'. > >[1] https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#dataTypeFormat >[2] https://tools.ietf.org/html/rfc3339#section-5.6 > >To test: >- Apply the regression tests patch >- Run: > k$ prove t/DateUtils.t >=> FAIL: Tests fail because dateonly is not implemented >- Apply this patch >- Run: > k$ prove t/DateUtils.t >=> SUCCESS: Tests pass! >- Sign off :-D > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/DateUtils.pm | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > >diff --git a/Koha/DateUtils.pm b/Koha/DateUtils.pm >index 2b8ee8b5a2..459a5a89d7 100644 >--- a/Koha/DateUtils.pm >+++ b/Koha/DateUtils.pm >@@ -254,8 +254,13 @@ sub output_pref { > : $dt->strftime("%Y-%m-%d $time"); > } > elsif ( $pref =~ m/^rfc3339/ ) { >- $date = $dt->strftime('%FT%T%z'); >- substr($date, -2, 0, ':'); # timezone "HHmm" => "HH:mm" >+ if (!$dateonly) { >+ $date = $dt->strftime('%FT%T%z'); >+ substr($date, -2, 0, ':'); # timezone "HHmm" => "HH:mm" >+ } >+ else { >+ $date = $dt->strftime("%Y-%m-%d"); >+ } > } > elsif ( $pref =~ m/^metric/ ) { > $date = $dateonly >-- >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 19816
:
84372
|
84373
|
84393
|
84394
|
84586
| 84587