Bug 19816 - output_pref must implement 'dateonly' for dateformat => rfc3339
Summary: output_pref must implement 'dateonly' for dateformat => rfc3339
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Target Milestone: ---
Assignee: Tomás Cohen Arazi
QA Contact: Martin Renvoize
URL:
Whiteboard:
Keywords:
Depends on: 18330
Blocks: 20006 22206
  Show dependency treegraph
 
Reported: 2017-12-14 19:49 UTC by Jonathan Druart
Modified: 2019-02-15 06:10 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Bug 19816: Regression tests (1.38 KB, patch)
2019-01-24 17:35 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 19816: Implement dateonly for rfc3339 format (1.51 KB, patch)
2019-01-24 17:35 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 19816: Regression tests (1.43 KB, patch)
2019-01-25 07:50 UTC, Josef Moravec
Details | Diff | Splinter Review
Bug 19816: Implement dateonly for rfc3339 format (1.56 KB, patch)
2019-01-25 07:50 UTC, Josef Moravec
Details | Diff | Splinter Review
Bug 19816: Regression tests (1.50 KB, patch)
2019-01-31 15:47 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 19816: Implement dateonly for rfc3339 format (1.63 KB, patch)
2019-01-31 15:47 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2017-12-14 19:49:48 UTC

    
Comment 1 Tomás Cohen Arazi 2018-01-02 17:27:28 UTC
Even if the RFC doesn't target date-only representations, full-date is proposed to be used in OpenAPI, so we should support it.
Comment 2 Tomás Cohen Arazi 2019-01-24 17:22:55 UTC
OpenAPI specifies a format for date-only formatted strings (1). It basically specifies that for 'date' format, the 'full-date' profile needs to be used [2]

Reopening.

[1] https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#dataTypeFormat

[2] https://tools.ietf.org/html/rfc3339#section-5.6
Comment 3 Tomás Cohen Arazi 2019-01-24 17:35:25 UTC
Created attachment 84372 [details] [review]
Bug 19816: Regression tests

This patch adds tests for the rfc3339 behaviour when dateonly => 1.

To test:
- Run:
  $ kshell
 k$ prove t/DateUtils.t
=> SUCCESS: Tests pass
- Apply this patch
- Run:
 k$ prove t/DateUtils.t
=> FAIL: dateonly is not implemented
Comment 4 Tomás Cohen Arazi 2019-01-24 17:35:28 UTC
Created attachment 84373 [details] [review]
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
Comment 5 Josef Moravec 2019-01-25 07:50:32 UTC
Created attachment 84393 [details] [review]
Bug 19816: Regression tests

This patch adds tests for the rfc3339 behaviour when dateonly => 1.

To test:
- Run:
  $ kshell
 k$ prove t/DateUtils.t
=> SUCCESS: Tests pass
- Apply this patch
- Run:
 k$ prove t/DateUtils.t
=> FAIL: dateonly is not implemented

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 6 Josef Moravec 2019-01-25 07:50:36 UTC
Created attachment 84394 [details] [review]
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>
Comment 7 Martin Renvoize 2019-01-31 15:47:35 UTC
Created attachment 84586 [details] [review]
Bug 19816: Regression tests

This patch adds tests for the rfc3339 behaviour when dateonly => 1.

To test:
- Run:
  $ kshell
 k$ prove t/DateUtils.t
=> SUCCESS: Tests pass
- Apply this patch
- Run:
 k$ prove t/DateUtils.t
=> FAIL: dateonly is not implemented

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 8 Martin Renvoize 2019-01-31 15:47:38 UTC
Created attachment 84587 [details] [review]
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>
Comment 9 Martin Renvoize 2019-01-31 15:48:13 UTC
Trivial enhancement, passes all tests. Passing QA.
Comment 10 Nick Clemens 2019-02-04 17:42:53 UTC
Awesome work all!

Pushed to master for 19.05
Comment 11 Martin Renvoize 2019-02-11 13:20:38 UTC
Pushed to 18.11.x for 18.11.03.
Comment 12 Lucas Gass 2019-02-12 17:02:35 UTC
backported to 18.05.x for 18.05.09
Comment 13 Fridolin SOMERS 2019-02-15 06:10:47 UTC
Depends on Bug 18330 not in 17.11.x