tremor icon indicating copy to clipboard operation
tremor copied to clipboard

Only select single day in Datepicker

Open StefBrands opened this issue 2 years ago • 4 comments

The Datepicker component seems to only allow date ranges, is it currently possible to set it to selecting a single date?

StefBrands avatar Oct 19 '22 18:10 StefBrands

If it's okay to have also the range selection, then it's already possible to choose only one date.

32f4e654-023a-4b5b-8238-1dcebd9080a8.webm

If not, I think the DatePicker component needs to be updated with a new attribute single or something like this.

noxify avatar Oct 19 '22 22:10 noxify

Okay great! That's definitely a workaround for now, thank you! For future it would be nice indeed to block the option of selecting a range if the goal output is always a single date.

StefBrands avatar Oct 20 '22 15:10 StefBrands

I agree, its a great date picker but in certain circumstance I'd like to use it for just choosing a single date to filter daily graphs

thornec avatar Oct 21 '22 12:10 thornec

It seems the handleSelect does not get triggered when selecting a single day. It only gets triggered when selecting a range.

StefBrands avatar Oct 25 '22 18:10 StefBrands

Hi all, thanks for providing all the feedback! In a dashboard context we believe a date range picker as it is implemented currently makes more sense, since data is always filtered for a time window rather than a single point in time. Now: in the near future we aim to extend the Datepicker component with the ability to filter for time ranges as well, which will effectively allow to select a single date. Let us know what you think :)

mitrotasios avatar Nov 07 '22 22:11 mitrotasios

What's the difference between time windows and time ranges you mentioned? @mitrotasios

eykrehbein avatar Nov 08 '22 10:11 eykrehbein

Sorry that wasn't clear. What I mean is that we want to allow filtering for time ranges and not only for dates as it is currently the case. (e.g. 2022-10-10 12:00 to 2022-10-10 19:00)

mitrotasios avatar Nov 08 '22 23:11 mitrotasios

Okay, that would be a nice addition. But in terms of selecting individual days, wouldn't it be quite cumbersome to select "01-11-2022 0:00 to 01-11-2022 23:59" to select a single day? I'd like to see a built-in shortcut that, for example, selects that time span by default when you click on a single day, and then you could select custom hours after that

eykrehbein avatar Nov 09 '22 09:11 eykrehbein

Okay, that would be a nice addition. But in terms of selecting individual days, wouldn't it be quite cumbersome to select "01-11-2022 0:00 to 01-11-2022 23:59" to select a single day? I'd like to see a built-in shortcut that, for example, selects that time span by default when you click on a single day, and then you could select custom hours after that

I agree with @eykrehbein . I guess if you're looking at it purely for graphs, a single day wouldn't make much sense but for a lot of other implementations selecting a single day is exactly what you want to do and doing it through the hassle of selecting a to and from that are on the same day seems unnecessary.

StefBrands avatar Nov 09 '22 11:11 StefBrands

Also here to 👍 this feature request. To give a concrete use case, we have a number of charts in a dashboard that are looking at WoW data at day-level granularity. For example our default view is to show yesterday's data (for example Saturday) and then compare that to the previous 6 Saturdays data. Comparison at a longer date range simply isn't valuable given the type of data we're comparing and we aren't day-parting our data so looking at it as a time range doesn't provide additional value.

bernsno avatar Nov 28 '22 02:11 bernsno

Hey @bernsno, thanks for the comment. This feature will be included in our next minor release which is currently released on @beta-1.2.0.

mitrotasios avatar Nov 28 '22 09:11 mitrotasios