Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
flacoman91 committed Nov 1, 2024
1 parent 5da2fc7 commit 734be86
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/reducers/query/querySlice.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,6 @@ export const querySlice = createSlice({
datesChanged: {
reducer: (state, action) => {
let { maxDate, minDate } = action.payload;

const fields = ['date_received_min', 'date_received_max'];

minDate = dayjs(minDate).isValid()
? formatDate(dayjs(minDate).startOf('day'))
: null;
Expand All @@ -151,19 +148,19 @@ export const querySlice = createSlice({
: null;

const datesChanged =
state[fields[0]] !== minDate || state[fields[1]] !== maxDate;
state.date_received_min !== minDate ||
state.date_received_max !== maxDate;

const dateRange = calculateDateRange(minDate, maxDate);

// only modify dateRange when we use the date filter, not company filter
if (dateRange && datesChanged) {
state.dateRange = dateRange;
} else {
delete state.dateRange;
}

state[fields[0]] = minDate || state[fields[0]];
state[fields[1]] = maxDate || state[fields[1]];
state.date_received_min = minDate || state.date_received_min;
state.date_received_max = maxDate || state.date_received_max;
validateDateInterval(state);
},
prepare: (minDate, maxDate) => {
Expand Down

0 comments on commit 734be86

Please sign in to comment.