Bug 29254

Summary: Setting wrong dates on additional-contents.pl
Product: Koha Reporter: Lucas Gass <lucas>
Component: ToolsAssignee: Jonathan Druart <jonathan.druart+koha>
Status: RESOLVED FIXED QA Contact: Marcel de Rooy <m.de.rooy>
Severity: normal    
Priority: P5 - low CC: florian.bontemps, jonathan.druart+koha, kyle, m.de.rooy, oleonard
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Text to go in the release notes:
Version(s) released in:
21.11.00
Bug Depends on: 28961    
Bug Blocks:    
Attachments: Bug 29254: Fix date formatting on the additional contents form
Bug 29254: Fix date formatting on the additional contents form
Bug 29254: Fix date formatting on the additional contents form

Description Lucas Gass 2021-10-15 17:43:37 UTC
To recreate:

1. Go to Tools > News or Tools > HTML customization
2. Make a New entry. Set a Publication date and Expiration date. ( if you leave them unset thats OK too, you will still experience the bug)
3. Save the entry
4. Open it again with either CodeMirror or TinyMCE.
5. The Publication date and Expiration date are set far into the future ( for me it is always setting it to 08/06/2026 )
6. Your content will no longer appear in the area it is supposed.
Comment 1 Lucas Gass 2021-10-15 22:05:05 UTC
Apologies, I may have been too quick in blaming this on Flatpickr or Bug 28961. This may have more to do with Bug 24387.
Comment 2 Lucas Gass 2021-10-17 19:09:42 UTC
It does appear to be Flatpickr and date Formats. When the dateformat string that is passed to the Flatpickr config is set to 'Y-m-d' it properly sets the date. With all other date formats it sets a wrong date.
Comment 3 Jonathan Druart 2021-10-18 09:51:39 UTC
Created attachment 126418 [details] [review]
Bug 29254: Fix date formatting on the additional contents form

We are sending ymd but flatpickr is expecting a 'dateformat' formatted
date.

Test plan:
Create a new content, set a date, save, edit again
=> The date must be displayed correctly
Comment 4 Marcel de Rooy 2021-10-18 09:58:36 UTC
Here is our friend again:

 FAIL   koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt
   FAIL   valid_template
                Attempt to reload Koha/Template/Plugin/Branches.pm aborted.
Compilation failed in require at /usr/lib/x86_64-linux-gnu/perl5/5.28/Template/Plugins.pm line 206.
Comment 5 Marcel de Rooy 2021-10-18 10:05:34 UTC
Created attachment 126422 [details] [review]
Bug 29254: Fix date formatting on the additional contents form

We are sending ymd but flatpickr is expecting a 'dateformat' formatted
date.

Test plan:
Create a new content, set a date, save, edit again
=> The date must be displayed correctly

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 6 Marcel de Rooy 2021-10-18 10:06:10 UTC
Taking liberty to PQA in one pass
Comment 7 Lucas Gass 2021-10-18 17:19:29 UTC
Created attachment 126451 [details] [review]
Bug 29254: Fix date formatting on the additional contents form

We are sending ymd but flatpickr is expecting a 'dateformat' formatted
date.

Test plan:
Create a new content, set a date, save, edit again
=> The date must be displayed correctly

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 8 Lucas Gass 2021-10-18 17:20:35 UTC
Adding my sign-off here for good measure. Works with all dateformat options. 

Thanks Jonathan and Marcel.
Comment 9 Jonathan Druart 2021-10-19 07:45:16 UTC
Pushed to master for 21.11, thanks to everybody involved!
Comment 10 Jonathan Druart 2021-10-22 12:25:35 UTC
*** Bug 29276 has been marked as a duplicate of this bug. ***