Skip to content

bug: replace strptime() with ISO parsers for date/time parsing #784

Closed

Description

The _parse_date, _parse_datetime, and _parse_time helpers use datetime.strptime(), triggering Ruff DTZ007 due to naive datetime construction.

Replace the manual format loops with the appropriate fromisoformat() APIs to:

  • Remove the DTZ007 warnings.
  • Simplify the parsing logic.
  • Preserve the existing supported date, datetime, and time formats.

Add/update regression tests to verify the existing parsing behavior remains unchanged.

Activity

  1. github-actions commented on Sep 12, 2026

    @github-actions

    Hi Lakshay Chauhan (@nos1dot618), thank you for opening this issue!

    Our team will review it shortly. We aim to triage all new issues within 24-48 hours and get back to you.

    If you have additional information to share, please feel free to update the issue.

    Thank you for your patience!

  2. nos1dot618 commented on Sep 12, 2026

    @nos1dot618
    Author

    After some digging, I found that date.fromisoformat() is stricter than the previous strptime(..., "%Y-%m-%d") behavior. The previous implementation accepted dates with single-digit month/day components, such as 2024-5-2, whereas fromisoformat() rejects them and returns None.

    Since this changes previously supported behavior and the goal is to maintain compatibility, I think it would be better to retain the existing functionality by normalizing the components before calling fromisoformat() (or retaining a compatibility fallback), along with a regression test for this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    triage neededFor new issues, not triaged yet.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions