Problem/Motivation
We are encountering the following error when just the time is changed:

Steps to reproduce
We have the following settings for our date field instance:

For the form display, we are using the "Smart Date inline range" widget and have the "Hide the end date field unless it's different from the start date." checkbox checked.
Proposed resolution
TBD
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 3272338-3.patch | 666 bytes | pyrello |
Issue fork smart_date-3272338
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
pyrello commentedAs far as I can tell, this seems to be happening because the JS seems to expect that the
input.alldayelement is going to be present no matter what and that doesn't actually seem to be the case: https://git.drupalcode.org/project/smart_date/-/blob/3.5.x/js/smart_date...In the linked snippet, it will only change the time if it finds the
input.alldayelement AND the element is checked. However if the element doesn't exist, the entire code block is skipped, causing the end time to not be set when it should be.Proposed solution at this point is to add an extra check to the first line to first see if the
input.alldayelement doesn't exist followed by an||and then the current check. A patch is forthcoming.I'm only looking at a particular use case to test this, so it may have other unexpected side effects.
Comment #4
pyrello commentedSetting to needs review to trigger tests. Also I'm uploading a patch because this fixes a bug that we have in production right now.
Comment #6
mandclu commentedThanks for identifying this, and for proposing a fix. I decided that the check you added made the following test for
wrapper.querySelector('input.allday')redundant, so I removed it in favour of the new one. I tested the change with your use case and it still seemed to fix it. Merged in, hoping to roll a new release shortly.Comment #7
pyrello commentedCool! Thanks, @mandclu!