Skip to content

Commit

Permalink
Fix whitespace, and round times to the previous multiple of the 'step…
Browse files Browse the repository at this point in the history
…' option, if necessary.
  • Loading branch information
tjhunt committed Jul 23, 2007
1 parent ba92364 commit 5aed300
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/form/datetimeselector.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,19 +133,21 @@ function onQuickFormEvent($event, $arg, &$caller)
}
if (!is_array($value)) {
$currentdate = usergetdate($value);
// Round minutes to the previous multiple of step.
$currentdate['minutes'] -= $currentdate['minutes'] % $this->_options['step'];
$value = array(
'minute' => $currentdate['minutes'],
'hour' => $currentdate['hours'],
'day' => $currentdate['mday'],
'month' => $currentdate['mon'],
'year' => $currentdate['year']);
// If optional, default to off, unless a date was provided
if($this->_options['optional']) {
if($this->_options['optional']) {
$value['off'] = ($requestvalue == 0) ? true : false;
}
} else {
$value['off'] = (isset($value['off'])) ? true : false;
}
} else {
$value['off'] = (isset($value['off'])) ? true : false;
}
if (null !== $value){
$this->setValue($value);
}
Expand Down

0 comments on commit 5aed300

Please sign in to comment.