Skip to content

Commit

Permalink
MDL-60682 forms: date/times should use step 1 minute by default
Browse files Browse the repository at this point in the history
  • Loading branch information
timhunt committed Nov 21, 2017
1 parent 4275ea4 commit 223419d
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions calendar/tests/calendartype_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,11 @@ private function convert_dateselector_to_unixtime_test($element, $type, $date) {
$counter++;

if ($element == 'dateselector') {
$el = $this->mform->addElement('date_selector', 'dateselector' . $counter, null, array('timezone' => 0.0, 'step' => 1));
$el = $this->mform->addElement('date_selector',
'dateselector' . $counter, null, array('timezone' => 0.0));
} else {
$el = $this->mform->addElement('date_time_selector', 'dateselector' . $counter, null, array('timezone' => 0.0, 'step' => 1, 'optional' => false));
$el = $this->mform->addElement('date_time_selector',
'dateselector' . $counter, null, array('timezone' => 0.0, 'optional' => false));
}
$submitvalues = array('dateselector' . $counter => $date);

Expand Down
2 changes: 1 addition & 1 deletion lib/form/dateselector.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function __construct($elementName = null, $elementLabel = null, $options
// Get the calendar type used - see MDL-18375.
$calendartype = \core_calendar\type_factory::get_calendar_instance();
$this->_options = array('startyear' => $calendartype->get_min_year(), 'stopyear' => $calendartype->get_max_year(),
'defaulttime' => 0, 'timezone' => 99, 'step' => 5, 'optional' => false);
'defaulttime' => 0, 'timezone' => 99, 'step' => 1, 'optional' => false);
// TODO MDL-52313 Replace with the call to parent::__construct().
HTML_QuickForm_element::__construct($elementName, $elementLabel, $attributes);
$this->_persistantFreeze = true;
Expand Down
2 changes: 1 addition & 1 deletion lib/form/datetimeselector.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function __construct($elementName = null, $elementLabel = null, $options
// Get the calendar type used - see MDL-18375.
$calendartype = \core_calendar\type_factory::get_calendar_instance();
$this->_options = array('startyear' => $calendartype->get_min_year(), 'stopyear' => $calendartype->get_max_year(),
'defaulttime' => 0, 'timezone' => 99, 'step' => 5, 'optional' => false);
'defaulttime' => 0, 'timezone' => 99, 'step' => 1, 'optional' => false);

// TODO MDL-52313 Replace with the call to parent::__construct().
HTML_QuickForm_element::__construct($elementName, $elementLabel, $attributes);
Expand Down
2 changes: 1 addition & 1 deletion lib/form/defaultcustom.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function __construct($elementname = null, $elementlabel = null, $options
'startyear' => $calendartype->get_min_year(),
'stopyear' => $calendartype->get_max_year(),
'defaulttime' => 0,
'step' => 5,
'step' => 1,
'optional' => false,
];

Expand Down
2 changes: 1 addition & 1 deletion mod/quiz/mod_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
*/
class mod_quiz_mod_form extends moodleform_mod {
/** @var array options to be used with date_time_selector fields in the quiz. */
public static $datefieldoptions = array('optional' => true, 'step' => 1);
public static $datefieldoptions = array('optional' => true);

protected $_feedbacks;
protected static $reviewfields = array(); // Initialised in the constructor.
Expand Down

0 comments on commit 223419d

Please sign in to comment.