I understand that () => {} does not need return, however if it is not there then Eslint complains about unused expressions.
export const isInInterval = (from, to, target) => {
if (isNaN(Date.parse(to)) && isNaN(Date.parse(from)) === true) {
return
}
const toUnixTimestamp = time => new Date(time).getTime()
toUnixTimestamp(to) - target > toUnixTimestamp(from) ? true : false
}
Here is the function: it tries to find out whether some specified date(to) minus specified period(target) is later in time than from. It should return true if so and false in the opposite case.
I keep bumping into eslint error expected assignment to a function call and instead saw expression.
I tried to rewrite it several times, but in most iterations I got `arrow function expects no return error, ex.:
return (toUnixTimestamp(to) - target > toUnixTimestamp(from)) ? true : false
isDateValidand then your first line can beif (!isDateValid(to) || !isDateValid(from)) return;