johnpolacek / date-range-picker-for-shadcn

DateRangePicker is a reusable component for shadcn using Radix UI and Tailwind CSS. Includes preset date ranges, text entry, calendar selection and date comparison
https://date-range-picker-for-shadcn-demo.vercel.app/
MIT License
700 stars 28 forks source link

Today and Yesterday Pre selects not working, #7

Open hilyas786786 opened 7 months ago

hilyas786786 commented 7 months ago

Hi firstly let me say, amazing component, i love it.

I noticed in Console.logs

<DateRangePicker onUpdate={(values) => { const { range } = values; console.log( Selected Date Range: From ${range.from.toISOString()} to ${range.to?.toISOString()} );

Selected Date Range: From 2024-04-01T23:00:00.000Z to 2024-04-01T23:00:00.000Z

This is what i get back when i select, Today,

Selected Date Range: From 2024-03-31T23:00:00.000Z to 2024-03-31T23:00:00.000Z

This is what i get back when i select Yesterday,

Selected Date Range: From 2024-03-31T00:00:00.000Z to 2024-04-01T23:00:00.000Z

This is what i get back when i select Last week.

Everything works expect Today & Yesterday, the Console.logs shows a specific moment for Today & Yesterday rather then capturing the entire day

johnpolacek commented 6 months ago

Not following your example, as toISOString() will always output hours:minutes:seconds