Bug 38027

Summary: Clearing a flatpickr datetime causes errors
Product: Koha Reporter: Lucas Gass (lukeg) <lucas>
Component: Architecture, internals, and plumbingAssignee: Lucas Gass (lukeg) <lucas>
Status: Pushed to main --- QA Contact: Julian Maurice <julian.maurice>
Severity: normal    
Priority: P5 - low CC: julian.maurice, phil
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.11.00
Circulation function:
Bug Depends on:    
Bug Blocks: 37398    
Attachments: Bug 38027: Set date to empty value instead of using flatpickr clear()
Bug 38027: Set date to empty value instead of using flatpickr clear()
Bug 38027: Set date to empty value instead of using flatpickr clear()
Bug 38027: (QA follow-up) Fix flatpickr onChange when input is cleared

Description Lucas Gass (lukeg) 2024-09-27 20:06:09 UTC
Found while working on Bug 37398.

To recreate:

1. Find a datetime field in Koha. For example, specifying due dates on the checkout page.
2. Specify a datetime.
3. Use the red 'X' icon to clear the date.
4. Notice a console error 'parsedDate' is undef
5. Now the flatpickr is date, not datetime
Comment 1 Lucas Gass (lukeg) 2024-09-27 21:20:34 UTC
Created attachment 172185 [details] [review]
Bug 38027: Set date to empty value instead of using flatpickr clear()

1. Find a datetime field in Koha. For example, specifying due dates on the checkout page.
2. Specify a datetime.
3. Use the red 'X' icon to clear the date.
4. Notice a console error 'parsedDate' is undef
5. Now the flatpickr is date, not datetime
6. APPLY patch
7. Try again, this time no console error and the flatpickr remains a datetime one
Comment 2 Phil Ringnalda 2024-09-27 21:47:44 UTC
Created attachment 172186 [details] [review]
Bug 38027: Set date to empty value instead of using flatpickr clear()

1. Find a datetime field in Koha. For example, specifying due dates on the checkout page.
2. Specify a datetime.
3. Use the red 'X' icon to clear the date.
4. Notice a console error 'parsedDate' is undef
5. Now the flatpickr is date, not datetime
6. APPLY patch
7. Try again, this time no console error and the flatpickr remains a datetime one

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Comment 3 Julian Maurice 2024-10-04 14:09:51 UTC
Created attachment 172400 [details] [review]
Bug 38027: Set date to empty value instead of using flatpickr clear()

1. Find a datetime field in Koha. For example, specifying due dates on the checkout page.
2. Specify a datetime.
3. Use the red 'X' icon to clear the date.
4. Notice a console error 'parsedDate' is undef
5. Now the flatpickr is date, not datetime
6. APPLY patch
7. Try again, this time no console error and the flatpickr remains a datetime one

Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Comment 4 Julian Maurice 2024-10-04 14:09:54 UTC
Created attachment 172401 [details] [review]
Bug 38027: (QA follow-up) Fix flatpickr onChange when input is cleared

With the onChange event handler fixed, it's ok to call clear() instead
of setDate('')

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Comment 5 Katrin Fischer 2024-10-11 09:15:44 UTC
Pushed for 24.11!

Well done everyone, thank you!