fix: should filter habits by start date
This commit is contained in:
parent
3c0c34d187
commit
71987799c0
@ -92,10 +92,14 @@ export const HabitsList: React.FC<HabitsListProps> = (props) => {
|
|||||||
>
|
>
|
||||||
{habitsTracker.habitsHistory[frequency]
|
{habitsTracker.habitsHistory[frequency]
|
||||||
.filter((habitItem) => {
|
.filter((habitItem) => {
|
||||||
|
const startDate = new Date(habitItem.habit.startDate)
|
||||||
|
startDate.setHours(0, 0, 0, 0)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
startDate <= selectedDate &&
|
||||||
|
(habitItem.habit.endDate == null ||
|
||||||
(habitItem.habit.endDate != null &&
|
(habitItem.habit.endDate != null &&
|
||||||
habitItem.habit.endDate >= selectedDate) ||
|
habitItem.habit.endDate >= selectedDate))
|
||||||
habitItem.habit.endDate == null
|
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.map((item) => {
|
.map((item) => {
|
||||||
|
Reference in New Issue
Block a user