Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-50486

Add units option to the 'duration' form element.

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • 2.7.4
    • Forms Library
    • MOODLE_27_STABLE

      The 'duration' form element (as defined in /lib/form/duration.php) can only be used to select weeks, days, hours, minutes and seconds as units of time.

      It should be straightforward to allow alternative units to be provided via the options argument.

      The form element would be more useful if you could supply your preferred units like this:

      $units = array(
          YEARSECS => get_string('years'),
          DAYSECS * 30 => get_string('months'),
          DAYSECS => get_string('days')
      );
      $options = array ('units' => $units);
      $mform->addElement('duration', 'lengthofexperience', 'name', $options);
      

            timhunt Tim Hunt
            josephc Joseph Cape
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.