Problem/Motivation

Our project uses Scheduler for publishing and unpublishing content.

One challenge we regularly encounter is that our production cron runs once per hour, while editors frequently schedule content for times such as:

10:15
10:30
10:45

They naturally expect the content to be published exactly at those times, but because cron only executes hourly, the scheduled action does not happen until the next cron run. This has resulted in a significant amount of user confusion and repeated support requests, as editors often assume Scheduler is not working correctly.

To reduce this confusion, we wanted to limit the available scheduling precision to whole hours only, matching the actual cron execution frequency.

Steps to reproduce

Proposed resolution

Initial approach

I initially attempted to implement this in the same way as the existing Hide seconds option.

The implementation was straightforward:

introduce a new Hide minutes configuration option;
set #date_increment = 3600;
normalise stored values by resetting minutes and seconds to zero.

Unfortunately, this exposed a limitation of the native HTML5 input[type="time"] widget.

While browsers correctly hide the seconds field when the step is set to 60 seconds, they do not hide the minutes when the step is increased to one hour (3600).

Instead:

the widget still displays minutes;
users can still select arbitrary minute values;
Scheduler correctly rounds the value back to :00 on submission;
however, the UI continues showing the user-selected minutes until the form is submitted.

This creates a confusing user experience because the value displayed in the widget does not match the value that will ultimately be stored.

Alternative approach

As a proof of concept, I implemented an alternative widget that replaces the HTML5 time input with hour-only select elements.

This avoids the HTML5 limitation entirely and only allows valid hour values to be selected.

There were some integration challenges because Drupal's core datetime form element is designed around the native HTML5 widget, but these were largely resolved.

Remaining tasks

Current limitations

This implementation should be considered a proof of concept rather than production-ready.

Known limitations include:

currently supports 12-hour (AM/PM) format only;
does not currently support 24-hour display;
localisation could be improved;
the implementation is more intrusive than the existing Hide seconds feature because it replaces part of the widget instead of simply adjusting the HTML5 input configuration.

If there is interest from the maintainers, I'd be happy for this work to serve as a starting point for a more polished implementation.

The attached patch demonstrates one possible approach that could be refined and integrated into Scheduler in the future.

User interface changes

UI
UI Node Form

API changes

none

Data model changes

none

Issue fork scheduler-3613620

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

pavel ruban created an issue. See original summary.

pavel ruban’s picture

StatusFileSize
new13.17 KB

patch against 2.3.0

pavel ruban’s picture

Status: Active » Needs review
pavel ruban’s picture

StatusFileSize
new24.43 KB
new17.84 KB

ignore this

pavel ruban’s picture

StatusFileSize
new13.95 KB
new6.08 KB

patch against 2.3.0

* allow empty values submit, style validation errors.
** removed accidently added garbage commits from #5