filter the posts using a before date if supplied
769999
function filterBefore(posts) {
      before = moment(before.replace(/\//g, '-'), 'MM-DD-YYYY', true);
      if (!before.isValid()) {
        console.log(chalk.red('Before date is not valid (expecting `MM-DD-YYYY`), ignoring argument.'));
        return posts;
      }

      return posts.filter(function filterPosts(post) {
        return moment(post.date).isBefore(before);
      });
    }
488238
def query_dated(num=8, kind='1'):
        '''
        
        '''
        return TabPost.select().where(
            TabPost.kind == kind
        ).order_by(
            TabPost.time_update.asc()
        ).limit(num)
910962
def posted_since(self):
        
        try:
            if self._data_from_search:
                info = self._data_from_search.find(
                    'div', {"class": "date_entered"}).text
                s = info.split(':')
                return s[-1].strip()
            else:
                div = self._ad_page_content.find(
                    'div', {'class': 'description_extras'})
                index = [i for i, s in enumerate(
                    div.contents) if 'Entered/Renewed' in str(s)][0] + 1
                return re.search("([0-9]{1,2}/[0-9]{1,2}/[0-9]{4})", str(div.contents[index]))[0]
        except Exception as e:
            if self._debug:
                logging.error(
                    "Error getting posted_since. Error message: " + e.args[0])
            return
524865
function checkFilter(filter, type, test, real) {
    if (type == Table.TYPE_DATETIME) {
        if (typeof real != 'object')
            real = new Date(real * 1000);
        if (filter == Table.FILTER_BETWEEN
                && Array.isArray(test) && test.length == 2) {
            test = [
                test[0] ? moment.unix(test[0]) : null,
                test[1] ? moment.unix(test[1]) : null,
            ];
        } else if (filter != Table.FILTER_BETWEEN) {
            test = moment.unix(test);
        } else {
            return null;
        }
    } else {
        if (filter == Table.FILTER_BETWEEN) {
            if (!Array.isArray(test) || test.length != 2)
                return null;
        }
    }

    switch (filter) {
        case Table.FILTER_LIKE:
            return real !== null && real.indexOf(test) != -1;
        case Table.FILTER_EQUAL:
            return real !== null && test == real;
        case Table.FILTER_BETWEEN:
            if (real === null)
                return false;
            if (test[0] !== null && real < test[0])
                return false;
            if (test[1] !== null && real > test[1])
                return false;
            return true;
        case Table.FILTER_NULL:
            return real === null;
        default:
            throw new Error("Unknown filter: " + filter);
    }

    return false;
}
1202336
function ruleBefore($date, $error_message = null) {
        if (!strtotime($date)) {
            throw new \Exception('Incorrect date');
        }

        return $this->_rule('before:' . $date, $error_message);
    }
685153
def date_range_filter(range_name):
    """"""

    filter_days = list(filter(
        lambda time: time["label"] == range_name,
        settings.CUSTOM_SEARCH_TIME_PERIODS))
    num_days = filter_days[0]["days"] if len(filter_days) else None

    if num_days:
        dt = timedelta(num_days)
        start_time = timezone.now() - dt
        return Range(published={"gte": start_time})
    return MatchAll()
262686
protected function filterTimestamp(&$query, $attr = 'updated_at')
    {
        if (!is_null($this->{$attr}) && strpos($this->{$attr}, ' - ') !== false ) {
            list($start_date, $end_date) = explode(' - ', $this->{$attr});
            $query->andFilterWhere(['>=', $attr, (int)strtotime($start_date)]);
            $query->andFilterWhere(['<=', $attr, (int)strtotime($end_date) + 24 * 3600]);
        }
    }
459762
def pre_filter(self):
        
        if self._name not in self.PRE_FILTER_FIELDS or self._template:
            return ''
        if not self._value:
            return '"equal={},cat="'.format(self.PRE_FILTER_FIELDS[self._name])

        if self._is_regex:
            needle = self._value[1:-1]
            needle = self.CLEAN_PRE_VAL_RE.sub(' ', needle)
            needle = self.SPLIT_PRE_VAL_RE.split(needle)
        else:
            needle = self.CLEAN_PRE_VAL_RE.sub(' ', self._value)
            needle = self.SPLIT_PRE_GLOB_RE.split(needle)
        needle = list(sorted(needle, key=len))[-1]

        if needle:
            try:
                needle.encode('ascii')
            except UnicodeEncodeError:
                return ''
            else:
                return r'"string.contains_i=${},\"{}\""'.format(
                       self.PRE_FILTER_FIELDS[self._name], needle.replace('"', r'\\\"'))

        return ''
1133514
def include? date
      result = false
      walk { |elements|
        break result = true if elements.include? date 
      }

      return result if !result || date.class == Date || times.nil?

      times.include? date
    end
1065370
function filter_date(value) {
    var m = DATE_RE.exec(value);
    if(m == null) throw OptError('Expected a date representation in the "yyyy-mm-dd" format.');
    return new Date(parseInt(m[0]), parseInt(m[1]), parseInt(m[2]));
}
364513
def apply_pre_filters(instance, html):
    
    # Allow pre processing. Typical use-case is HTML syntax correction.
    for post_func in appsettings.PRE_FILTER_FUNCTIONS:
        html = post_func(instance, html)

    return html
1229120
def during(self, year, month):
		""""""
		return self.filter(created__year=year, created__month=month)
704556
def query_filter_date(start, end):
    
    sdate = datetime.datetime.strptime(start, "%Y-%m-%d")
    edate = datetime.datetime.strptime(end, "%Y-%m-%d")
    startdate = "%s/%s/%s" % (sdate.month, sdate.day, sdate.year)
    enddate = "%s/%s/%s" % (edate.month, edate.day, edate.year)
    return {
        'operation': 'betweenDate',
        'options': [
            {'name': 'startDate', 'value': [startdate + ' 0:0:0']},
            {'name': 'endDate', 'value': [enddate + ' 0:0:0']}
        ]
    }
715132
def __update_filter(self):
        
        filters = list()
        if self.__date_filter:
            filters.append(self.__date_filter)
        if self.__text_filter:
            filters.append(self.__text_filter)
        self.document_controller.display_filter = ListModel.AndFilter(filters)
468668
def where_after_entry(query, ref):
    
    return orm.select(
        e for e in query
        if e.local_date > ref.local_date or
        (e.local_date == ref.local_date and
         e.id > ref.id
         )
    )
525309
function filterMonth(arr, year, disabledDateObj) {
  const minDateTime = new Date(year, 0, 1).getTime();
  const maxDateTime = new Date(year, 11, 31).getTime();
  const monthRangeArr = getDateRangeArr(disabledDateObj, minDateTime, maxDateTime);
  const monthArr = [];
  monthRangeArr.forEach((item) => {
    let { start, end } = item;
    start = new Date(start);
    end = new Date(end);

    const monthStart = start.getMonth();
    const monthEnd = end.getMonth();
    const dayStart = start.getDate();
    const dayEnd = new Date(end.getTime() + 86400000).getDate();
    if (dayStart === 1) {
      if (dayEnd === 1) {
        for (let i = monthStart; i <= monthEnd; i++) {
          monthArr.push(i);
        }
      } else {
        for (let i = monthStart; i < monthEnd; i++) {
          monthArr.push(i);
        }
      }
    }
    if (dayEnd === 1) {
      for (let i = monthStart + 1; i <= monthEnd; i++) {
        monthArr.push(i);
      }
    } else {
      for (let i = monthStart + 1; i < monthEnd; i++) {
        monthArr.push(i);
      }
    }
  });
  return arr.filter((item) => {
    const month = item.value;
    return monthArr.indexOf(month) === -1;
  });
}
925050
function filterTitle(posts) {
      var reTitle = title.map(function makeRE(word) {
        return new RegExp(word, 'i');
      });

      return posts.filter(function filterPosts(post) {
        return reTitle.every(function checkRE(regex) {
          return regex.test(post.title) || regex.test(post.slug);
        });
      });
    }