Swagger2 wants dates and date-times as defined in RFC3339, https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14 Make sure each object property has a format date or date-time defined where needed. We should include information on time zone and use an appropriate separator "T" between date and time, e.g.: 2017-03-24T14:00:00+02:00 2017-03-24T12:00:00Z
Created attachment 63603 [details] [review] Bug 18330: Add RFC3339 to Koha::DateUtils To test: 1. prove t/DateUtils.t
Created attachment 63604 [details] [review] Bug 18330: Handle date-time in Koha::Object->TO_JSON This patch formats timestamps and datetimes to meet date-time definition in RFC3339, as required by Swagger documentation.
Created attachment 63605 [details] [review] Bug 18330: (follow-up) Add note to update tests when upgrading Mojolicious I noticed this test file is broken with Mojolicious 7. It is because they have replaced Mojo::JSON::_Bool with JSON::PP::Boolean. This patch adds TODO comment to easily identify the issue when updating.
(In reply to Lari Taskula from comment #3) > Created attachment 63605 [details] [review] [review] > Bug 18330: (follow-up) Add note to update tests when upgrading Mojolicious > > I noticed this test file is broken with Mojolicious 7. It is because they > have replaced Mojo::JSON::_Bool with JSON::PP::Boolean. This patch adds > TODO comment to easily identify the issue when updating. Marked this patch obsolete as it is fixed in Bug 18290.
Created attachment 69726 [details] [review] Bug 18330: Add RFC3339 to Koha::DateUtils To test: 1. prove t/DateUtils.t Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no>
Created attachment 69727 [details] [review] Bug 18330: Handle date-time in Koha::Object->TO_JSON This patch formats timestamps and datetimes to meet date-time definition in RFC3339, as required by Swagger documentation. Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no>
All tests pass. Good work!
Created attachment 69749 [details] [review] Bug 18330: Add RFC3339 to Koha::DateUtils To test: 1. prove t/DateUtils.t Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 69750 [details] [review] Bug 18330: Handle date-time in Koha::Object->TO_JSON This patch formats timestamps and datetimes to meet date-time definition in RFC3339, as required by Swagger documentation. Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 69751 [details] [review] Bug 18330: (follow-up) Adapt holds.t to match the new datetime format Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
What do we do if output_pref is called with dateformat => rfc3339 and dateonly => 1?
(In reply to Jonathan Druart from comment #11) > What do we do if output_pref is called with dateformat => rfc3339 and > dateonly => 1? Raise an exception because RFC doesn't cover that use case?
Pushed to master for 18.05, thanks to everybody involved!
# Failed test 'Test::Perl::Critic for "Koha/Object.pm"' # at /usr/share/perl5/Test/Perl/Critic.pm line 110. # # Perl::Critic found these violations in "Koha/Object.pm": # "return" statement with explicit "undef" at line 227, column 17. See page 199 of PBP. (Severity: 5) # Looks like you failed 1 test of 854. [20:13:10] t/00-testcritic.t I let you deal with that one.
Created attachment 69851 [details] [review] Bug 18330: Do not return undef explicitely This patch fixes a perl critic issue, hopefully it will not break something else. Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Last patch has been pushed to master.
Awesome work all! Enhancement, not backporting for 17.11
*** Bug 18293 has been marked as a duplicate of this bug. ***
This implementation is not correct, the timezone from the string should be taken into account (and UTC used if not provided). See bug 25621