Closed rlskoeser closed 2 weeks ago
@coderabbitai full review
[!IMPORTANT]
Review skipped
Auto reviews are disabled on base/target branches other than the default branch.
Please check the settings in the CodeRabbit UI or the
.coderabbit.yaml
file in this repository. To trigger a single review, invoke the@coderabbitai review
command.You can disable this status message by setting the
reviews.review_status
tofalse
in the CodeRabbit configuration file.
The changes introduced enhance the functionality of the date handling system by expanding type support and improving the parsing and formatting capabilities of the Undate
and UndateInterval
classes. New methods for parsing and formatting date strings have been added, allowing for greater flexibility in handling different date formats. Additionally, tests have been implemented to ensure the correctness of these new features.
Files | Change Summary |
---|---|
src/undate/dateformat/base.py |
Updated import statements to include Union for enhanced type hinting. |
src/undate/dateformat/edtf/formatter.py , src/undate/dateformat/iso8601.py |
Modified to_string methods to accept both Undate and UndateInterval , adding a new helper method for string conversion. |
src/undate/undate.py |
Introduced parse and format methods for Undate and UndateInterval classes to handle date string conversion. |
tests/test_undate.py |
Added new test cases for parsing and formatting functionalities in Undate and UndateInterval . |
sequenceDiagram
participant User
participant Undate
participant Formatter
User->>Undate: parse(date_string, format)
Undate->>Formatter: get appropriate formatter
Formatter-->>Undate: formatter found
Undate->>Formatter: call parse method
Formatter-->>Undate: return Undate/UndateInterval object
Undate-->>User: return parsed object
sequenceDiagram
participant User
participant Undate
participant Formatter
User->>Undate: format(format)
Undate->>Formatter: get appropriate formatter
Formatter-->>Undate: formatter found
Undate->>Formatter: call to_string method
Formatter-->>Undate: return formatted string
Undate-->>User: return formatted string
Objective | Addressed | Explanation |
---|---|---|
support using different formatters for input and output (#[87]) | ✅ |
🐇 Hopping through the fields so bright,
With new formats to parse, oh what a delight!
From Undate to intervals, we dance with glee,
Formatting dates as easy as can be!
So let’s celebrate this change with cheer,
For a world of dates is finally here! 🌼✨
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
@coderabbitai full review
Attention: Patch coverage is 96.87500%
with 1 line
in your changes missing coverage. Please review.
Please upload report for BASE (
feature/edtf-formatter@5668c52
). Learn more about missing BASE report.
Files with missing lines | Patch % | Lines |
---|---|---|
src/undate/undate.py | 93.75% | 1 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
add undate parse and format methods (~ analogous to datetime.strptime and strftime) to allow parsing and formatting dates as strings using any defined formatter class (to be expanded later for more formatting options)
this resolves #87 and is something we can built out for more flexible formatting options later
Summary by CodeRabbit
New Features
Undate
andUndateInterval
classes.Bug Fixes
Tests
Undate
andUndateInterval
classes to validate parsing and formatting functionality across various date formats.