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 #256

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

swt30
Copy link

@swt30 swt30 commented May 8, 2023

This is a first pass at a DateRangePicker as described in #255.

image

To see it in action, open the src/DateRangePicker.jl notebook.

I wanted something that behaved like this:

  • Lets the user select a start and end date
  • Returns the range from the start to end date (a StepRange with step of one day)
  • Needs both dates to be set (i.e. no ranges going to Inf because StepRange doesn't support that) and the start date to be <= the end date.

It's not fully working yet. I have used transformed_value, as in ScrubbableMatrix, to build a DateRangePicker out of two DatePickers. But this causes problems when the range isn't valid (e.g. if no default range is set). There are some assertions for validation in the inner function of transformed_value, but transformed_value turns these into its own error tuple, which bubbles up to the bound value itself. So a default DateRangePicker() returns an error tuple instead of nothing, which doesn't feel right to me:

image

The error logging above also doesn't disappear when a correct range is entered. I'll experiment; maybe I need to log an @error and return nothing instead of using @assert in the inner function.

Addresses #255

@github-actions
Copy link

github-actions bot commented May 8, 2023

Try this Pull Request!

Open Julia and type:

julia> import Pkg
julia> Pkg.activate(temp=true)
julia> Pkg.add(url="https://github.com/swt30/PlutoUI.jl", rev="date-range-picker")
julia> using PlutoUI

Or run this code in your browser: Run with binder

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.

None yet

1 participant