Problem

When hide_seconds is enabled and another module triggers an AJAX form rebuild (e.g., Yoast SEO), the scheduler time field reverts to its original value, losing the user's changes.

Steps to reproduce

  1. Enable "Hide seconds" in Scheduler settings
  2. Enable Yoast SEO (or any module that triggers AJAX on node forms)
  3. Edit a node with a scheduled publish/unpublish time
  4. Change the time field
  5. Edit the title or body (triggers Yoast AJAX)
  6. Time field reverts to original value

Cause

In js/scheduler_default_time.js, the hide-seconds code (lines 44-59) runs on every Drupal.behaviors.attach() without once() protection:

// Runs on EVERY AJAX request, overwriting user input:
elementPublishOn.val(drupalSettings.schedulerHideSecondsPublishOn);

The default-time functionality (lines 21-39) correctly uses once(), but hide-seconds does not.

Fix

Add once() protection to prevent running on subsequent AJAX calls. Patch attached.

Issue fork scheduler-3565013

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

dennisdk created an issue.

jonathan1055’s picture

Thanks @dennisdk for opening the issue and for creating the MR. I am going to replicate this locally then test your fix.

jonathan1055’s picture

I must be missing a step, as I can't replicate this problem. I have installed and enabled Yoast CEO. I ticked the 'auto refresh' checkbox (which was not listed in the Steps to reproduce) but still I don't see anything. The help mentions a widget. Do you know where that is displayed. Do you know what I need to check to see if Ajax form rebuild is not being done?