Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@pranaybattu
Copy link
Contributor

@pranaybattu pranaybattu commented Oct 7, 2024

Describe your changes

  • refine date_input to ensure consistent and accurate return types
  • Added overloads to handle both single and range date inputs with specific return types
  • Added type tests using assert_type for various scenarios, including single dates, date ranges, formats, min/max values, disabled state, and on_change callbacks

GitHub Issue Link (if applicable)

Testing Plan

  • Explanation of why no additional tests are needed
  • Unit Tests (JS and/or Python)
  • E2E Tests
  • Any manual testing needed?

Contribution License Agreement

By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.

DateWidgetReturn: TypeAlias = Union[
date, Tuple[()], Tuple[date], Tuple[date, date], None
]
DateTupleReturn: TypeAlias = Union[Tuple[()], Tuple[date], Tuple[date, date], None]
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think about calling DateTupleReturn something like DateWidgetRangeReturn to help document that this is used to specify date ranges?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, Sounds good to me. It would certainly help to clearly document that this is used specifically to specify date ranges and helps with readability.

Copy link
Contributor

@sfc-gh-nbellante sfc-gh-nbellante left a comment

Choose a reason for hiding this comment

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

thanks for the contribution!

@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 2024

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Nov 4, 2024
@jrieke
Copy link
Collaborator

jrieke commented Nov 4, 2024

Hey @pranaybattu, seems like a bunch of tests are failing. Might be worth bringing this on the latest state of develop, since it looks like some of the failures are because of pillow being pinned to <11, but on the latest develop branch we increased that limit to <12. As soon as the tests are running through, we can merge this!

@github-actions github-actions bot removed the stale label Nov 5, 2024
@lukasmasuch lukasmasuch added security-assessment-completed Security assessment has been completed for PR change:bugfix PR contains bug fix implementation impact:users PR changes affect end users labels Nov 13, 2024
@pranaybattu
Copy link
Contributor Author

@jrieke seems issue with test cases, forgot to rename in tests. Updating code

@lukasmasuch lukasmasuch changed the title feat: refine date_input to ensure consistent and accurate return types Refine st.date_input to ensure consistent and accurate return types Jan 3, 2025
@lukasmasuch lukasmasuch enabled auto-merge (squash) January 3, 2025 19:49
Copy link
Collaborator

@lukasmasuch lukasmasuch left a comment

Choose a reason for hiding this comment

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

LGTM 👍 I applied a couple of fixes to get it through our CI.

@lukasmasuch lukasmasuch merged commit f9b7887 into streamlit:develop Jan 3, 2025
31 checks passed
edegp pushed a commit to edegp/streamlit that referenced this pull request Jan 19, 2025
…streamlit#9620)

## Describe your changes

- refine date_input to ensure consistent and accurate return types
- Added overloads to handle both single and range date inputs with
specific return types
- Added type tests using assert_type for various scenarios, including
single dates, date ranges, formats, min/max values, disabled state, and
on_change callbacks
## GitHub Issue Link (if applicable)

- Closes to streamlit#9477 

## Testing Plan

- Explanation of why no additional tests are needed
- Unit Tests (JS and/or Python)
- E2E Tests
- Any manual testing needed?

---

**Contribution License Agreement**

By submitting this pull request you agree that all contributions to this
project are made under the Apache 2.0 license.

---------

Co-authored-by: Lukas Masuch <[email protected]>
Co-authored-by: Lukas Masuch <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:bugfix PR contains bug fix implementation impact:users PR changes affect end users security-assessment-completed Security assessment has been completed for PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants