Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.setState(oldState => {
let oldTimeTo = oldState.queryParams.timeTo;
if (DateUtils.isDayAfter(new Date(e), new Date(oldTimeTo))) {
oldTimeTo = DateUtils.addMonths(new Date(e), 1);
}
return {
queryParams: {
...oldState.queryParams,
timeFrom: moment(e),
timeTo: moment(oldTimeTo),
},
};
});
}