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

Issue fork smart_date-3272338

Command icon 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

pyrello created an issue. See original summary.

pyrello’s picture

As far as I can tell, this seems to be happening because the JS seems to expect that the input.allday element 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.allday element 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.allday element 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.

pyrello’s picture

Status: Active » Needs review
StatusFileSize
new666 bytes

Setting to needs review to trigger tests. Also I'm uploading a patch because this fixes a bug that we have in production right now.

  • mandclu committed b8328bb on 3.6.x
    Issue #3272338 by pyrello, mandclu: Issues with time in Smart Date...
mandclu’s picture

Status: Needs review » Fixed

Thanks 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.

pyrello’s picture

Cool! Thanks, @mandclu!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.