End key ignores calendarStartDay for non-Sunday weeks

Author: dimazuienCreated Sep 4, 2026Updated Sep 8, 2026

Describe the bug

When calendarStartDay is set to a value other than 0, keyboard navigation with the Home and End keys uses inconsistent week boundaries.

For example, with calendarStartDay={1}:

  • Home correctly moves focus to Monday, the first day of the week.
  • End incorrectly moves focus to Saturday.
  • End should move focus to Sunday, the last day of a Monday–Sunday week.

This occurs because the Home handler passes locale and calendarStartDay to getStartOfWeek, while the End handler calls getEndOfWeek without either value.

To Reproduce

typescript
import {useState} from 'react';
import DatePicker from 'react-datepicker';
import 'react-datepicker/dist/react-datepicker.css';

export default function App() {
  const [selected, setSelected] = useState<Date | null>(
    new Date(2024, 5, 12)
  );

  return (
    <DatePicker
      inline
      selected={selected}
      onChange={setSelected}
      calendarStartDay={1}
    />
  );
}
  1. Focus Wednesday, June 12, 2024.
  2. Press Home.
  3. Focus moves to Monday, June 10, which is correct.
  4. Focus Wednesday, June 12 again.
  5. Press End.
  6. Focus moves to Saturday, June 15.

Expected behavior

With calendarStartDay={1}, pressing End should move focus to Sunday, June 16—the last day of the configured Monday–Sunday week.

Home and End should calculate their destinations using the same locale and calendarStartDay configuration.

Screenshots

Not applicable.

Desktop (please complete the following information):

  • OS: macOS Tahoe 26.6.2
  • Browser: Chrome
  • Version: 152

Smartphone (please complete the following information):

Not applicable.

Additional context

Source: Hacker0x01/react-datepicker