Skip to content

parse of date with duration cause error #881

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
2 tasks done
mlongtin0 opened this issue Mar 17, 2025 · 1 comment
Open
2 tasks done

parse of date with duration cause error #881

mlongtin0 opened this issue Mar 17, 2025 · 1 comment

Comments

@mlongtin0
Copy link

  • 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=...)

@himanshubohra13
Copy link

Hey @mlongtin0
Can I look into this issue?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants