Merge pull request #440 from react-bootstrap-table/develop

20180730 release
This commit is contained in:
Allen 2018-07-30 23:16:26 +08:00 committed by GitHub
commit e26065b116
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 6 deletions

View File

@ -131,7 +131,7 @@ const columns = [..., {
Numner filter is same as other filter, you can custom the number filter via `numberFilter` factory function:
```js
import filterFactory, { selectFilter, Comparator } from 'react-bootstrap-table2-filter';
import filterFactory, { selectFilter, Comparator, numberFilter } from 'react-bootstrap-table2-filter';
// omit...
const numberFilter = numberFilter({
@ -240,4 +240,4 @@ Following properties is valid in `FILTER_TYPES`:
* TEXT
* SELECT
* NUMBER
* DATE
* DATE

View File

@ -93,12 +93,16 @@ class DateFilter extends Component {
}
applyFilter(value, comparator) {
if (!comparator || !value) {
return;
}
// if (!comparator || !value) {
// return;
// }
const { column, onFilter, delay } = this.props;
const execute = () => {
const date = typeof value !== 'object' ? new Date(value) : value;
// Incoming value should always be a string, and the defaultDate
// above is implemented as an empty string, so we can just check for that.
// instead of parsing an invalid Date. The filter function will interpret
// null as an empty date field
const date = value === '' ? null : new Date(value);
onFilter(column, FILTER_TYPE.DATE)({ date, comparator });
};
if (delay) {