angular-ui/ui-grid

uiGridConstants.filter.CONTAINS not working for date filters

Open

#3,807 创建于 2015年6月18日

在 GitHub 查看
 (1 评论) (1 反应) (0 负责人)JavaScript (2,496 fork)batch import
good first issuetype: bug

仓库指标

Star
 (5,395 star)
PR 合并指标
 (30 天内没有已合并 PR)

描述

Filing a new issue as closed PRs don't give notifications.

This is a reference to this PR: https://github.com/angular-ui/ng-grid/pull/2772

The following code:

    if (filter.flags.date === true) {
      value = new Date(value);
      // If the term has a dash in it, it comes through as '\-' -- we need to take out the '\'.
      term = new Date(term.replace(/\\/g, ''));
    }

only executes if condition is not uiGridConstants.filter.STARTS_WITH, ENDS_WITH, CONTAINS, or EXACT.

However, in the case of a user typing dates into a column filter, it's very common for them to type a partial match of the date. Date comparisons only being restricted to GREATER_THAN, GREATER_THAN_OR_EQUAL, LESS_THAN, LESS_THAN_OR_EQUAL is not sufficient.

贡献者指南