Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DateRangePicker widget #6027

Merged
merged 2 commits into from
Dec 11, 2023
Merged

Conversation

TheoMathurin
Copy link
Contributor

@TheoMathurin TheoMathurin commented Dec 11, 2023

Replaces #2804
Closes #5844 and maybe #3789

As far as I know this reuse of Bokeh's implementation works fine.

As it's my first widget addition I'm open to suggestions to get closer to existing practices.

A small code to try it:

import datetime as dt
import panel as pn
import panel.widgets as pnw


def display_value(event):
    col.append(date_range_picker.value)


def set_value(event):
    date_range_picker.value = (dt.date(2019, 1, 2), dt.date(2019, 1, 5))


def set_start_end(event):
    date_range_picker.start = dt.date(2020, 1, 2)
    date_range_picker.end = dt.date(2020, 2, 5)


date_range_picker = pnw.DateRangePicker(name='Date Range Picker', start=dt.date(2019, 1, 1), end=dt.date(2019, 1, 10))
button1 = pnw.Button(name='Display Value', on_click=display_value)
button2 = pnw.Button(name='Set Value', on_click=set_value)
button3 = pnw.Button(name='Set start end', on_click=set_start_end)

row = pn.Row(date_range_picker, pn.Column(button1, button2, button3))
col = pn.Column(row)

col.servable()

Copy link

codecov bot commented Dec 11, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (fb36731) 84.68% compared to head (90f15cb) 72.89%.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #6027       +/-   ##
===========================================
- Coverage   84.68%   72.89%   -11.79%     
===========================================
  Files         291      291               
  Lines       43730    43793       +63     
===========================================
- Hits        37032    31924     -5108     
- Misses       6698    11869     +5171     
Flag Coverage Δ
ui-tests ?
unitexamples-tests 72.89% <100.00%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@TheoMathurin TheoMathurin marked this pull request as draft December 11, 2023 09:45
@TheoMathurin TheoMathurin force-pushed the add-daterange-picker branch 2 times, most recently from 0e21e68 to 109c2ac Compare December 11, 2023 10:35
@TheoMathurin TheoMathurin marked this pull request as ready for review December 11, 2023 10:36
Copy link
Member

@philippjfr philippjfr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@philippjfr philippjfr mentioned this pull request Dec 11, 2023
@philippjfr philippjfr merged commit 4d88374 into holoviz:main Dec 11, 2023
10 of 13 checks passed
@TheoMathurin TheoMathurin deleted the add-daterange-picker branch December 11, 2023 14:49
@fmfreeze
Copy link

fmfreeze commented Mar 9, 2024

@philippjfr may I ask, when this Daterangepicker is available in an official release?

And does it also support single date picking (start_date = end_date)? This is currently not supported by pn.widgets.DatetimeRangePicker when disabling time functionality.

@philippjfr
Copy link
Member

Tagging 1.4.0rc1 on Monday so hopefully over the course of next week.

@philippjfr
Copy link
Member

On the second part I'd have to check, you could try it out with 1.4.0b2 today.

@fmfreeze
Copy link

fmfreeze commented Mar 9, 2024

On monday i will try with 1.4.0b2, thank you!

@TheoMathurin
Copy link
Contributor Author

Same day selection is supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add DateRangePicker
3 participants