-
-
Notifications
You must be signed in to change notification settings - Fork 58
Add string support to get_localized_time function #595
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 string support to get_localized_time function #595
Conversation
- Updated docstring to document string input support - Fixed incorrect param description (was 'Message to show', now 'Date/time to display') - Updated type annotation to include string - Added test_get_localized_time_string() test case - Tests various string datetime formats (ISO 8601) Fixes plone#593
|
@Sreevarsh-Mahesh you need to sign the Plone Contributor Agreement to merge this pull request. Learn about the Plone Contributor Agreement: https://plone.org/foundation/contributors-agreement If you have already signed the agreement, please allow a week for your agreement to be processed. If after a week you have not received an invitation, then please contact [email protected]. |
|
@Sreevarsh-Mahesh thanks for creating this Pull Request and helping to improve Plone! TL;DR: Finish pushing changes, pass all other checks, then paste a comment: To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass, but it takes 30-60 min. Other CI checks are usually much faster and the Plone Jenkins resources are limited, so when done pushing changes and all other checks pass either start all Jenkins PR jobs yourself, or simply add the comment above in this PR to start all the jobs automatically. Happy hacking! |
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.
Pull request overview
This PR adds support for string datetime inputs to the get_localized_time() helper function by documenting its existing capability to accept string inputs. The underlying ulocalized_time() method in plone.base already handles string-to-DateTime conversion, so only documentation and test updates were needed.
- Updated docstring to clarify that string inputs are accepted and how they are processed
- Fixed parameter description from "Message to show" to "Date/time to display"
- Added comprehensive test coverage for string datetime inputs
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/plone/api/portal.py | Updated get_localized_time() docstring to document string input support and corrected parameter description |
| src/plone/api/tests/test_portal.py | Added test_get_localized_time_string() method testing ISO 8601 datetime strings, date-only strings, and various format options |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@Sreevarsh-Mahesh please read and follow First-time contributors, Contributing to Plone, and Contributing to |
|
Hi @stevepiercy, thank you for the guidance. I apologize for not following the proper procedure outlined in the First-time contributors guide. I have now signed the Plone Contributor Agreement and am waiting for the invitation to join the Contributors Team. I will close this PR for now. Once I receive and accept the invitation, I will:
Thank you for your patience as I learn the contribution process! |
Summary
This PR adds support for string datetime inputs to the
get_localized_time()helper function.Changes
get_localized_time()docstring to document string input supporttest_get_localized_time_string()with multiple string format scenariosDetails
The underlying
ulocalized_time()method in plone.base already handles string-to-DateTime conversion (via the DateTime constructor), so no actual code logic changes were needed - only documentation updates to make this capability clear to users.Tests
Added
test_get_localized_time_string()which tests:long_format=Truetime_only=TrueFixes #593
📚 Documentation preview 📚: https://ploneapi--595.org.readthedocs.build/