Improve edge case handling, tests, and documentation#24
Merged
chetmancini merged 1 commit intomasterfrom Jan 29, 2026
Merged
Conversation
Critical fixes: - Fix ISO8601 fractional seconds truncation (>6 digits now explicitly truncated) - Add DST ambiguous time documentation to convert_timezone() and datetime_to_utc() - Document parse_date() behavior for invalid calendar dates New edge case tests: - test_parse_iso8601_nanosecond_truncation: verify microsecond precision - test_datetime_to_utc_dst_ambiguous_times: document fold attribute behavior - test_parse_date_invalid_calendar_dates: Feb 29 non-leap, April 31, etc. - test_add_business_days_negative_cross_year_with_holidays: year boundary - test_get_week_number_jan1_in_previous_year_week: ISO week edge cases - test_format_timezone_offset_dst_variance: DST offset changes - Nepal UTC+5:45 minute-level offset test Documentation enhancements: - Add generator consumption warning to workdays_between() and add_business_days() - Add LRU cache size (maxsize=32) and thread safety notes to get_us_federal_holidays() - Add pretty_date() month/year approximation clarification - Add format_timezone_offset() current-moment offset note Co-Authored-By: Claude Opus 4.5 <[email protected]>
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR improves the dateutils library by addressing edge cases, adding comprehensive tests, and enhancing documentation based on a thorough code review.
Critical Fixes
foldattribute behavior toconvert_timezone()anddatetime_to_utc()parse_date()returnsNonefor invalid dates like Feb 29 in non-leap yearsNew Edge Case Tests
test_parse_iso8601_nanosecond_truncationtest_datetime_to_utc_dst_ambiguous_timesfoldbehaviortest_parse_date_invalid_calendar_datestest_add_business_days_negative_cross_year_with_holidaystest_get_week_number_jan1_in_previous_year_weektest_format_timezone_offset_dst_varianceUTC+5:45testDocumentation Enhancements
workdays_between()andadd_business_days()docstringsget_us_federal_holidays()pretty_date()approximations: Clarified that months=30 days, years=365 daysformat_timezone_offset()DST note: Documents that returned offset varies for DST zonesTest plan
make lint)make format-check)make typecheck)🤖 Generated with Claude Code