angular-ui/ui-grid

uiGridConstants.filter.CONTAINS not working for date filters

Open

#3807 aperta il 18 giu 2015

Vedi su GitHub
 (1 commento) (1 reazione) (0 assegnatari)JavaScript (2496 fork)batch import
good first issuetype: bug

Metriche repository

Star
 (5395 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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.

Guida contributor