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

feat: DateRangePicker Implementation #780

Merged
merged 42 commits into from
Sep 4, 2024

Conversation

dgodinez-dh
Copy link
Contributor

Closes #764

Copy link
Member

@mofojed mofojed left a 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"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

Comment on lines 167 to 173
```python
from deephaven import ui

my_date_range_picker_forms = ui.date_range_picker(
label="Trip dates", start_name="startDate", end_name="endDate"
)
```
Copy link
Member

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.

Suggested change
```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
)
```

Copy link
Contributor Author

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(
Copy link
Member

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.

Copy link
Contributor Author

@dgodinez-dh dgodinez-dh Aug 29, 2024

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.

Copy link
Member

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.

@dgodinez-dh dgodinez-dh removed the request for review from margaretkennedy August 29, 2024 20:40
@dgodinez-dh dgodinez-dh requested review from mofojed and removed request for margaretkennedy August 29, 2024 21:17
@dgodinez-dh dgodinez-dh requested review from mofojed and removed request for margaretkennedy August 30, 2024 14:36
plugins/ui/DESIGN.md Outdated Show resolved Hide resolved
plugins/ui/DESIGN.md Outdated Show resolved Hide resolved
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`
Copy link
Contributor

Choose a reason for hiding this comment

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

bullet list?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

plugins/ui/DESIGN.md Outdated Show resolved Hide resolved
plugins/ui/DESIGN.md Outdated Show resolved Hide resolved
plugins/ui/docs/components/date_range_picker.md Outdated Show resolved Hide resolved
plugins/ui/docs/components/date_range_picker.md Outdated Show resolved Hide resolved
plugins/ui/docs/components/date_range_picker.md Outdated Show resolved Hide resolved
plugins/ui/docs/components/date_range_picker.md Outdated Show resolved Hide resolved
plugins/ui/docs/components/date_range_picker.md Outdated Show resolved Hide resolved
mofojed
mofojed previously approved these changes Sep 3, 2024
Copy link
Member

@mofojed mofojed left a 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.

plugins/ui/docs/components/date_range_picker.md Outdated Show resolved Hide resolved
plugins/ui/docs/components/date_range_picker.md Outdated Show resolved Hide resolved
plugins/ui/docs/components/date_range_picker.md Outdated Show resolved Hide resolved

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:
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

plugins/ui/docs/components/date_range_picker.md Outdated Show resolved Hide resolved
plugins/ui/docs/components/date_range_picker.md Outdated Show resolved Hide resolved
plugins/ui/docs/components/date_range_picker.md Outdated Show resolved Hide resolved
plugins/ui/docs/components/date_range_picker.md Outdated Show resolved Hide resolved
@dgodinez-dh dgodinez-dh merged commit 088d623 into deephaven:main Sep 4, 2024
17 checks passed
@dgodinez-dh dgodinez-dh deleted the dag_DateRangePicker branch September 4, 2024 13:10
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.

ui.date_range_picker
3 participants