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
- Enable "Hide seconds" in Scheduler settings
- Enable Yoast SEO (or any module that triggers AJAX on node forms)
- Edit a node with a scheduled publish/unpublish time
- Change the time field
- Edit the title or body (triggers Yoast AJAX)
- 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
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 #3
jonathan1055 commentedThanks @dennisdk for opening the issue and for creating the MR. I am going to replicate this locally then test your fix.
Comment #4
jonathan1055 commentedI 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?