The 'datetime' element has the following text as documentation for the #date_increment property:

The increment to use for minutes and seconds, i.e. '15' would show only :00, :15, :30 and :45. Used for HTML5 step values and jQueryUI datepicker settings. Defaults to 1 to show every minute.

  • "The increment to use for minutes and seconds": it is used for hours too, if you specify 3600, the increment will be one hour.
  • The increment is expressed in seconds, so the last sentence is incorrect: 1 means show every second and every minute, 60 would mean show every minute, 300 would mean every 5 minutes and so on.
  • I stumbled across this when researching how to hide the "second" portion. Multiples of 60 will cause the "second" portion to be hidden, so I think this would be good to mention in the docs.
  • 'increment': it actually is a "step", so works in both directions, not just incrementing.

Proposed text:

The interval (step) to use when incrementing or decrementing time, in seconds. For example, if this value is set to 30, time increases (or decreases) in steps of 30 seconds (00:00:00, 00:00:30, 00:01:00, and so on.) If this value is a multiple of 60, the "seconds"-component will not be shown in the input. Used for HTML5 step values and jQueryUI datepicker settings. Defaults to 1 to show every second.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mr.baileys created an issue. See original summary.

mr.baileys’s picture

Issue summary: View changes
borisson_’s picture

Status: Needs review » Reviewed & tested by the community

This documentation improvement is great. I don't see anything that could improve this further. Great work @mr.baileys!

  • larowlan committed 3d2d2a1 on 8.6.x
    Issue #2941646 by mr.baileys: Documentation on datetime #date_increment...

  • larowlan committed fd877c1 on 8.5.x
    Issue #2941646 by mr.baileys: Documentation on datetime #date_increment...
larowlan’s picture

Version: 8.6.x-dev » 8.5.x-dev
Status: Reviewed & tested by the community » Fixed

Committed as 3d2d2a1 and pushed to 8.6.x.

Cherry-picked as fd877c1 and pushed to 8.5.x

Status: Fixed » Closed (fixed)

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