Skip to content

parse of date with duration cause error #881

Open
@mlongtin0

Description

@mlongtin0
  • I am on the latest Pendulum version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • OS version and name: Ubuntu 22.04.5 LTS
  • Pendulum version: 3.0.0
  • Python version: 3.10.12

Issue

Parsing duration with dates does this:

>>> pendulum.parse("2025-03-10/P3D")
...
TypeError: Date.add() got an unexpected keyword argument 'hours'

However, adding an hour to the date string works:

>>> pendulum.parse("2025-03-10T00/P3D")
<Interval [2025-03-10 00:00:00+00:00 -> 2025-03-13 00:00:00+00:00]>

It seems the internal datetime object is type Date, which doesn't support add(hours=...)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions