date-fns

Get last day of the Week returns date equivalent to one more day

To get the first day of the week of the date 07/10/2020, I used the function startOfWeek of the date-fns library. In this way ... 0/2020. const ultimoDiaSemana = endOfWeek(new Date(2020, 9, 7)); // 11/10/2020 errado I would like to know why this happens.