FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

`parse_dt` method that specifically returns a DateTime · Issue #917 · python-pendulum/pendulum · GitHub

parse_dt method that specifically returns a DateTime #917

Description

  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the documentation and believe that my question is not covered.

Feature Request

pdl.parse can return a Date, Time, Duration, or DateTime, depending on the args you pass to it. This is annoying in type-checked codebases, because you have to write

my_dt = pdl.parse(my_dt_string)
assert isinstance(my_dt, pdl.DateTime)

every time you want to parse a datetime string.

I wish there were a function parse_dt that was guaranteed to return a DateTime, and raises if you pass it something else like '2024-09-12T10:00:00Z/2024-09-12T15:30:00Z'.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


    Back | FazBrowse Home | New Git URL