Bug 19816

Summary: output_pref must implement 'dateonly' for dateformat => rfc3339
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: Architecture, internals, and plumbingAssignee: Tomás Cohen Arazi <tomascohen>
Status: CLOSED FIXED QA Contact: Martin Renvoize <martin.renvoize>
Severity: normal    
Priority: P5 - low CC: fridolin.somers, josef.moravec, lucas, martin.renvoize, nick, tomascohen
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 18330    
Bug Blocks: 20006, 22206    
Attachments: Bug 19816: Regression tests
Bug 19816: Implement dateonly for rfc3339 format
Bug 19816: Regression tests
Bug 19816: Implement dateonly for rfc3339 format
Bug 19816: Regression tests
Bug 19816: Implement dateonly for rfc3339 format

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