-
Notifications
You must be signed in to change notification settings - Fork 15
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
feat: DateRangePicker Implementation #780
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good overall! A few things to cleanup/change.
|
||
## HTML forms | ||
|
||
Date range pickr supports the start_name and end_name props for integration with HTML forms. The values will be submitted to the server as `ISO 8601` formatted strings according to the granularity of the value. For example, if the date range picker allows selecting only dates then strings such as "2023-02-03" will be submitted, and if it allows selecting times then strings such as "2023-02-03T08:45:00" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Date range pickr supports the start_name and end_name props for integration with HTML forms. The values will be submitted to the server as `ISO 8601` formatted strings according to the granularity of the value. For example, if the date range picker allows selecting only dates then strings such as "2023-02-03" will be submitted, and if it allows selecting times then strings such as "2023-02-03T08:45:00" | |
Date range picker supports the `start_name` and `end_name` props for integration with HTML forms. The values will be submitted to the server as `ISO 8601` formatted strings according to the granularity of the value. For example, if the date range picker allows selecting only dates then strings such as "2023-02-03" will be submitted, and if it allows selecting times then strings such as "2023-02-03T08:45:00" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
```python | ||
from deephaven import ui | ||
|
||
my_date_range_picker_forms = ui.date_range_picker( | ||
label="Trip dates", start_name="startDate", end_name="endDate" | ||
) | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This example doesn't make a ton of sense in isolation (I know it's copied from Spectrum). I'd wrap this in a ui.form
, e.g.
```python | |
from deephaven import ui | |
my_date_range_picker_forms = ui.date_range_picker( | |
label="Trip dates", start_name="startDate", end_name="endDate" | |
) | |
``` | |
```python | |
from deephaven import ui | |
my_date_range_picker_forms = ui.form( | |
ui.date_range_picker( | |
label="Trip dates", start_name="startDate", end_name="endDate" | |
), | |
ui.button("Submit", type="submit"), | |
on_submit=print | |
) | |
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
@@ -381,9 +396,57 @@ def convert_list_prop( | |||
return [str(_convert_to_java_date(date)) for date in value] | |||
|
|||
|
|||
def convert_date_range( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add some tests in test_date_picker.py
and/or test_utils.py
to have tests for this functionality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a test_date_range_picker.py
similar to test_date_picker.py
The date functionality does not appear to be tested directly in test_utils.py
but in the unit test for components.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're pushing more things off the page as we add more components.
We should split up the ui_components
into a couple components so we have a little more room and we're actually testing all components.
plugins/ui/DESIGN.md
Outdated
The range is a dictionary with a `start` date and an `end` date. e.g. `{ "start": "2024-01-02", "end": "2024-01-05" }` | ||
|
||
The date range picker accepts the following date types as inputs: | ||
`None`, `LocalDate`, `ZoneDateTime`, `Instant`, `int`, `str`, `datetime.datetime`, `numpy.datetime64`, `pandas.Timestamp` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bullet list?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
Co-authored-by: margaretkennedy <[email protected]>
Co-authored-by: margaretkennedy <[email protected]>
Co-authored-by: margaretkennedy <[email protected]>
Co-authored-by: margaretkennedy <[email protected]>
Co-authored-by: margaretkennedy <[email protected]>
Co-authored-by: margaretkennedy <[email protected]>
Co-authored-by: margaretkennedy <[email protected]>
Co-authored-by: margaretkennedy <[email protected]>
Co-authored-by: margaretkennedy <[email protected]>
Co-authored-by: margaretkennedy <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good codewise, wait for @margaretkennedy 's approval of docs before merging.
|
||
The `range` is a dictionary with a `start` date and an `end` date. e.g. `{ "start": "2024-01-02", "end": "2024-01-05" }` | ||
|
||
The date range picker accepts the following date types as inputs: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The date range picker accepts the following date types as inputs:
None
LocalDate
ZoneDateTime
Instant
int
str
datetime.datetime
numpy.datetime64
pandas.Timestamp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
Co-authored-by: margaretkennedy <[email protected]>
Co-authored-by: margaretkennedy <[email protected]>
Closes #764