What is a junk date? How do you reproduce this bug?
Created attachment 146584 [details] [review] Bug 32949: Do not fill form with wrong shadow value to avoid data loss in smart-rules.tt When you edit the rule without initializing flatpickr plugin, if you press the save button it will overwrite the date with an empty value, making you lose the dates. This happens because flatpickr plugin's shadow value is not loaded if it's not initialized with a click on that date field. This patch fixes it. 1st Code commit text: To reproduce: 1. Head over to the smart rules admin page and create/use existing rule for certain item type/category. 2. Set "hard due date" and "No automatic renewal after (hard limit)" of that rule to a certain date and save. 3. Edit that same rule again, but this time just save it without any changes. The data for hard due date and hard limit will get lost and will be set as "None defined". 4. Apply the patch. 5. Repeat steps 2 and 3. Ensure that the data loss is not happening anymore.
(In reply to Owen Leonard from comment #1) > What is a junk date? How do you reproduce this bug? Hey Owen, I already had a fix for it, was meant to push it asap after I created this bug, please see the patch and description of it for more info.
Created attachment 146587 [details] [review] Bug 32949: Do not fill form with wrong shadow value to avoid data loss in smart-rules.tt When you edit the rule without initializing flatpickr plugin, if you press the save button it will overwrite the date with an empty value, making you lose the dates. This happens because flatpickr plugin's shadow value is not loaded if it's not initialized with a click on that date field. This patch fixes it. 1st Code commit text: To reproduce: 1. Head over to the smart rules admin page and create/use existing rule for certain item type/category. 2. Set "hard due date" and "No automatic renewal after (hard limit)" of that rule to a certain date and save. 3. Edit that same rule again, but this time just save it without any changes. The data for hard due date and hard limit will get lost and will be set as "None defined". 4. Apply the patch. 5. Repeat steps 2 and 3. Ensure that the data loss is not happening anymore. Signed-off-by: Owen Leonard <oleonard@myacpl.org>
I don't have the patch applied, but I can't reproduce the issue. I also tried using another date format, but it all behaves nicely: * Set dateformat to DD.MM.YYYY * Create a circulation rule ALL-ALL-Books, with 21.2.2023 as hard due date and auto-renewal before. * Save rule. * Edit rule and save without changes. * Edit rule again - dates are still correct. Tested on master as of today. Also with the standard format MM.DD.YYYY. Can you please have a look?