- Issue created by @tame4tex
- 🇧🇪Belgium BramDriesen Belgium 🇧🇪
I vaguely remember trying NULL in the original issue as that also seemed more appropriate for me. But for some reason that was not possible (don't remember exactly why, guess if I look a bit at the code I might remember).
Test coverage for this use case is pretty OK now, so we can try to change this to NULL.
Probably good to add a test for states as well.
- 🇨🇦Canada tame4tex
So I finally had some time to revisit this issue and add states testing.
I have added the states testing in a separate issue https://www.drupal.org/project/time_field/issues/3479769 📌 Add form conditional states testing Active to keep this issue as simple as possible.
It turns out my initial assumption was incorrect, states is actually working. It was our custom code that interacts with states that was failing due to expecting an empty string would mean empty.
Regardless, I am still going to work on the proposed resolution to see if NULL will work. In my opinion it is a much better approach than relying on 86401, if for no other reason than to get rid of the console warnings.
- 🇧🇪Belgium BramDriesen Belgium 🇧🇪
Some more background info can be found here: https://www.drupal.org/project/time_field/issues/3423941#comment-15464729 🐛 After 2.1.1 update all time fields are treated as required; empty values not accepted. Postponed: needs info
- Merge request !24Issue #3463912: Use NULL to represent and empty time field instead of 86401 → (Merged) created by tame4tex
- 🇨🇦Canada tame4tex
I have implemented the proposed solution and opened a MR. All tests are passing and it appears to be working well on my site.
Given the complexity of the update hook to update existing table schema and field values I have also removed support for old Drupal versions.
- 🇨🇦Canada tame4tex
In case anyone else has issues, the patch from the MR needs to be modified to successfully apply via
cweagans/composer-patches
.The change to
time_field.info.yml
needs to be removed. See 📌 Packaging info from .info.yml often creates conflicts when patching (ddo) Active for more info.I have uploaded a working version of the patch.
- 🇧🇪Belgium BramDriesen Belgium 🇧🇪
I need to manually test the upgrade path on an existing site with data. Code wise this looks really good though, so I'm quite confident this will be ok.
And thank you for your work @tame4tex
- 🇨🇦Canada tame4tex
You're welcome and thanks for being such a great maintainer @bramdriesen!
- 🇧🇪Belgium BramDriesen Belgium 🇧🇪
Finally was able to test this manually, this works like it's expected to! Thanks again @tame4tex
-
bramdriesen →
committed 86efdaef on 2.x authored by
tame4tex →
Issue #3463912: Use NULL to represent and empty time field instead of...
-
bramdriesen →
committed 86efdaef on 2.x authored by
tame4tex →
- 🇧🇪Belgium BramDriesen Belgium 🇧🇪