Skip to content

Datepicker shows today’s date instead of provided range #324

@LatVAlY

Description

@LatVAlY

Description:
When passing a custom date range (e.g., 2022-01-01 to 2023-01-01) into the value prop, the datepicker renders the current date (2025) instead of the provided values.


Steps to Reproduce:

import Datepicker from "react-tailwindcss-datepicker";

export default function Test() {
  return (
    <Datepicker
      useRange
      showShortcuts
      value={{
        startDate: new Date(2022, 0, 1), // Jan 1, 2022
        endDate: new Date(2023, 0, 1),   // Jan 1, 2023
      }}
      onChange={(val) => console.log(val)}
    />
  );
}

Expected Behavior:
The picker should open showing January 2022 → January 2023 as the selected range.

Actual Behavior:
The picker falls back to today (August 2025) and ignores the provided values.


Environment:

  • react-tailwindcss-datepicker version: 1.7.3
  • React version: 18.2.0

Additional Notes:

  • Using new Date("2022-01-01") seems to be parsed incorrectly.
  • Even when using new Date(2022, 0, 1), the picker still falls back to today.
  • Might be an internal parsing/validation bug.
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions