holoviz / panel

Panel: The powerful data exploration & web app framework for Python
https://panel.holoviz.org
BSD 3-Clause "New" or "Revised" License
4.49k stars 490 forks source link

Hide time in DatetimeRangePicker widget if enable_time is false? #3789

Open TheoMathurin opened 1 year ago

TheoMathurin commented 1 year ago

The DatetimeRangePicker widget can be used as a date range picker if enable_time is False.

In this case it may be better to change the string format in the value field so that instead of the full datetime, you would simply see "2022-01-01 to 2022-01-02" as the time is not relevant in this context. It can also be confusing to display the time while it cannot be changed in the browser.

image

TheoMathurin commented 1 year ago

Sorry I did not know there was an open PR for a DateRangePicker. This issue may therefore be ignored.

If a dedicated date range picker widget exists, the "enable_time" option in DatetimeRangePicker could become obsolete.

TheoMathurin commented 1 year ago

I will close this issue when #2804 is merged. If it's decided that it's not the way to go, there could be a discussion on how to make DatetimeRangePicker more suitable for picking dates.

maximlt commented 1 year ago

I think it would indeed be nicer to have a DateRangePicker widget, to complete the series of the date/time widgets which makes them more easily discoverable.

MarcSkovMadsen commented 8 months ago

But still it would be nice to be able to control the formatting. The underlying Bokeh model has the format property. Panel has not implemented that.

hoxbro commented 8 months ago

I want to implement Bokeh's implementation of DatetimePicker, DatePicker, DatetimeRange, and DateRangePicker. Panel's current DatetimePicker and DatetimeRangePicker were implemented before Bokeh's current implementation and are based on an old version of DatePicker + some updates to work with Bokeh 3.

I haven't done it because of point 2 of https://github.com/bokeh/bokeh/issues/12904, where local timezones affect the start and end times.

cosmicfarmers commented 8 months ago

@MarcSkovMadsen Is there any workaround to hide time part before things improved/fixed?

TheoMathurin commented 7 months ago

Maybe enable_time could be removed from _DatetimePickerBase and this issue will be closed.

In fact I don't know what is the benefit from having enable_time = False in DatetimePicker. And now that DateRangePicker is coming, I'm struggling to think of a situation where it will be useful for DatetimeRangePicker either.