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

Feature Request: Can you add a time range, e.q. 08:00 - 14:00

Open RasmusJannerup opened this issue 1 year ago • 3 comments

I was wondering if you could add time range as a feature?

Btw. the component is very nice and useful! :D

RasmusJannerup avatar Jan 05 '24 10:01 RasmusJannerup

Will there be such a feature?

OrionPro avatar Jun 20 '25 19:06 OrionPro

In this fork https://github.com/onesine/react-tailwindcss-datepicker/commit/199fc839c1d897b3d380b8b70e443399cbb9b33a, it’s possible to pass the startTime and endTime props, and inside the component, we modify the displayFormat if const hasTimeRange = Boolean(startTime && endTime);

Time is in this format: '10:00'

Props:

displayFormat: hasTimeRange  
    ? 'MM/DD/YYYY HH:mm - HH:mm'  
    : 'MM/DD/YYYY',  
startTime: startTime,  
endTime: endTime,  

OrionPro avatar Jul 10 '25 18:07 OrionPro

The modal window is implemented via Popover.Portal (@radix-ui/react-popover). A custom wrapper is created around DatePicker to allow passing both the calendar itself and an Addon - in my case, it's two select inputs for time selection. Image

OrionPro avatar Jul 10 '25 18:07 OrionPro