Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove 5 days from the start and the end on availability table #184

Merged
merged 1 commit into from
Oct 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@

const selectedDateInterval = useMemo(() => {
return {
start: chrono(selectedDate).startOf('month').minus(5, 'day').getDate(),
end: chrono(selectedDate).endOf('month').plus(5, 'day').getDate()
start: chrono(selectedDate).startOf('month').getDate(),
end: chrono(selectedDate).endOf('month').getDate()
}
}, [selectedDate])

Expand All @@ -51,15 +51,15 @@
if (requiredFiltersAreSelected()) {
getAbsencesQry({
...absenceFilters,
startDate: chrono(selectedDateInterval.start).format(chrono.DATE_FORMAT),
endDate: chrono(selectedDateInterval.end).format(chrono.DATE_FORMAT)
startDate: chrono(selectedDateInterval.start).minus(5, 'day').format(chrono.DATE_FORMAT),
endDate: chrono(selectedDateInterval.end).plus(5, 'day').format(chrono.DATE_FORMAT)
}).then((absences) => {
setUserAbsences(absences)
})
} else {
setUserAbsences([])
}
}, [absenceFilters, selectedDateInterval])

Check warning on line 62 in src/features/binnacle/features/availability/ui/components/availability-table/availability-table.tsx

View workflow job for this annotation

GitHub Actions / Test

React Hook useEffect has missing dependencies: 'getAbsencesQry' and 'requiredFiltersAreSelected'. Either include them or remove the dependency array

const checkIfHoliday = (day: Date) =>
holidays.some((holiday) => chrono(day).isSameDay(holiday.date))
Expand All @@ -80,7 +80,7 @@
if (firstElement !== null) firstElement.scrollIntoView({ inline: 'center' })
}
setPreviousSelectedDate(selectedDate)
}, [userAbsences])

Check warning on line 83 in src/features/binnacle/features/availability/ui/components/availability-table/availability-table.tsx

View workflow job for this annotation

GitHub Actions / Test

React Hook useEffect has missing dependencies: 'previousSelectedDate', 'selectedDate', 'selectedDateInterval.end', and 'selectedDateInterval.start'. Either include them or remove the dependency array

const updateAbsencesBasedOnInterval = (userAbsence: UserAbsence) => {
return userAbsence.absences
Expand Down
Loading