react-tailwindcss-datepicker icon indicating copy to clipboard operation
react-tailwindcss-datepicker copied to clipboard

Datepicker shows today’s date instead of provided range

Open LatVAlY opened this issue 4 months ago • 0 comments

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

LatVAlY avatar Aug 19 '25 09:08 LatVAlY