/** * Restrict on a date field. * 'from' or 'to' may be empty. * @param string $field * @param DATE_TIME $from * @param DATE_TIME $to */ public function restrict_date($field, $from, $to) { if ($from && $from->is_valid()) { $this->restrict("{$field} >= '" . $from->as_ISO() . "'"); } if ($to && $to->is_valid()) { $this->restrict("{$field} <= '" . $to->as_ISO() . "'"); } }