Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

Commit

Permalink
Fix date format on DatePicker of FilterItem #1387
Browse files Browse the repository at this point in the history
  • Loading branch information
wiadev committed Jan 16, 2018
1 parent 531ed51 commit 179cb4d
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions src/components/filters/FiltersItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,23 +72,28 @@ class FiltersItem extends Component {
}
};

parseDateToReadable = value => {
if (value) {
return new Date(value);
}
};

mergeData = (property, value, valueTo) => {
const DATE_FIELD = "DateDoc";
this.setState(prevState => ({
filter: Object.assign({}, prevState.filter, {
parameters: prevState.filter.parameters.map(param => {
if (param.parameterName === property) {
return Object.assign(
{},
param,
valueTo
? {
value,
valueTo
}
: {
value
}
);
return Object.assign({}, param, {
value:
DATE_FIELD === property
? this.parseDateToReadable(value)
: value,
valueTo:
DATE_FIELD === property
? this.parseDateToReadable(valueTo)
: valueTo
});
} else {
return param;
}
Expand Down

0 comments on commit 179cb4d

Please sign in to comment.