Bug 38027 - Clearing a flatpickr datetime causes errors
Summary: Clearing a flatpickr datetime causes errors
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Lucas Gass (lukeg)
QA Contact: Julian Maurice
URL:
Keywords:
Depends on:
Blocks: 37398
  Show dependency treegraph
 
Reported: 2024-09-27 20:06 UTC by Lucas Gass (lukeg)
Modified: 2024-10-11 09:15 UTC (History)
2 users (show)

See Also:
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:


Attachments
Bug 38027: Set date to empty value instead of using flatpickr clear() (1.35 KB, patch)
2024-09-27 21:20 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 38027: Set date to empty value instead of using flatpickr clear() (1.40 KB, patch)
2024-09-27 21:47 UTC, Phil Ringnalda
Details | Diff | Splinter Review
Bug 38027: Set date to empty value instead of using flatpickr clear() (1.46 KB, patch)
2024-10-04 14:09 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 38027: (QA follow-up) Fix flatpickr onChange when input is cleared (1.59 KB, patch)
2024-10-04 14:09 UTC, Julian Maurice
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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!