'Render this widget as HTML helper object(s)
@param resource: the resource
@param values: the search values from the URL query'

def widget(self, resource, values):

    attr = self.attr
    _class = self._class
    if (('_class' in attr) and attr['_class']):
        _class = ('%s    %s' % (attr['_class'], _class))
    else:
        _class = _class
    _id = attr['_id']
    T = current.T
    input_class = self._input_class
    input_labels = self.input_labels
    opts_get = self.opts.get
    clear_text = opts_get('clear_text', None)
    hide_time = opts_get('hide_time', False)
    slider = opts_get('slider', False)
    if slider:
        auto_range = opts_get('auto_range', True)
    else:
        auto_range = opts_get('auto_range')
        if (auto_range is None):
            auto_range = current.deployment_settings.get_search_dates_auto_range()
    if auto_range:
        (minimum, maximum, ts) = self._options(resource, as_str=False)
    else:
        minimum = maximum = None
    filter_widget = DIV(_id=_id, _class=_class)
    append = filter_widget.append
    if slider:
        appname = current.request.application
        s3 = current.response.s3
        scripts_append = s3.scripts.append
        if s3.debug:
            if s3.cdn:
                scripts_append('https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.js')
                scripts_append('https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.17/d3.js')
            else:
                scripts_append(('/%s/static/scripts/moment.js' % appname))
                scripts_append(('/%s/static/scripts/d3/d3.js' % appname))
            scripts_append(('/%s/static/scripts/d3/nv.d3.js' % appname))
        else:
            if s3.cdn:
                scripts_append('https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js')
                scripts_append('https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.17/d3.min.js')
            else:
                scripts_append(('/%s/static/scripts/moment.min.js' % appname))
                scripts_append(('/%s/static/scripts/d3/d3.min.js' % appname))
            scripts_append(('/%s/static/scripts/d3/nv.d3.min.js' % appname))
        range_picker = DIV(_class='range-picker')
        ISO = '%Y-%m-%dT%H:%M:%S'
        if minimum:
            range_picker['_data-min'] = minimum.strftime(ISO)
        if maximum:
            range_picker['_data-max'] = maximum.strftime(ISO)
        if ts:
            range_picker['_data-ts'] = json.dumps(ts, separators=SEPARATORS)
        if hide_time:
            range_picker['_data-fmt'] = 'MMM    D    YYYY'
        else:
            range_picker['_data-fmt'] = 'MMM    D    YYYY    HH:mm'
        append(range_picker)
    get_variable = self._variable
    fields = self.field
    if (type(fields) is not list):
        fields = [fields]
        selector = self.selector
    else:
        selectors = self.selector.split('|')
    start = True
    for field in fields:
        if resource:
            rfield = S3ResourceField(resource, field)
            field = rfield.field
        else:
            rfield = field = None
        if (not field):
            if ((not rfield) or rfield.virtual):
                ftype = opts_get('fieldtype', 'datetime')
            else:
                return ''
        else:
            ftype = rfield.ftype
        if (not field):
            if rfield:
                (tname, fname) = (rfield.tname, rfield.fname)
            else:
                (tname, fname) = ('notable', 'datetime')
                if (not _id):
                    raise SyntaxError(('%s:    _id    parameter    required    when    rendered    without    resource.' % self.__class__.__name__))
            field = Field(fname, ftype, requires=IS_UTC_DATE())
            field.tablename = field._tablename = tname
        if (len(fields) == 1):
            operators = self.operator
        elif start:
            operators = ['ge']
            selector = selectors[0]
            start = False
        else:
            operators = ['le']
            selector = selectors[1]
            input_class += '    end_date'
        timepicker = (False if ((ftype == 'date') or hide_time) else True)
        if (timepicker and ('datetimepicker' not in input_class)):
            input_class += '    datetimepicker'
        for operator in operators:
            input_id = ('%s-%s' % (_id, operator))
            set_min = set_max = None
            if (operator == 'ge'):
                set_min = ('#%s-%s' % (_id, 'le'))
            elif (operator == 'le'):
                set_max = ('#%s-%s' % (_id, 'ge'))
            widget = S3CalendarWidget(timepicker=timepicker, minimum=minimum, maximum=maximum, set_min=set_min, set_max=set_max, clear_text=clear_text)
            value = values.get(get_variable(selector, operator))
            if (value in (None, [])):
                value = None
            elif (type(value) is list):
                value = value[0]
            if isinstance(value, basestring):
                dt = s3_decode_iso_datetime(value)
            else:
                dt = value
            if dt:
                if timepicker:
                    dtstr = S3DateTime.datetime_represent(dt, utc=False)
                else:
                    dtstr = S3DateTime.date_represent(dt, utc=False)
            else:
                dtstr = None
            picker = widget(field, dtstr, _class=input_class, _id=input_id, _name=input_id)
            if (operator in input_labels):
                label = DIV(LABEL(('%s:' % T(input_labels[operator])), _for=input_id), _class='range-filter-label')
            else:
                label = ''
            append(DIV(label, DIV(picker, _class='range-filter-widget'), _class='range-filter-field'))
    return filter_widget
