pendulum icon indicating copy to clipboard operation
pendulum copied to clipboard

Small typo in documentation substract method

Open qdesmedt opened this issue 1 year ago • 2 comments

  • [x] I have searched the issues of this repo and believe that this is not a duplicate.

Issue

There is a small typo in the doc for the pendulum object's subtract method.

https://github.com/python-pendulum/pendulum/blob/master/docs/docs/addition_subtraction.md?plain=1#L67

>>> dt = dt.subtract(minutes=1)
'2012-01-28 01:01:00'
>>> dt = dt.subtract(minutes=24)
'2012-01-28 00:00:00'

The result of dt.subtract(minutes=24) is wrong, it should be 2012-01-28 00:37:00

qdesmedt avatar Nov 26 '25 20:11 qdesmedt

Can I work on this?

ABolouk avatar Dec 06 '25 11:12 ABolouk

I've opened a PR to fix this: https://github.com/python-pendulum/pendulum/pull/949

Three incorrect values were found:

  • add(hours=1) result showed '2012-02-25' instead of '2012-01-29'
  • subtract(hours=1) result showed '2012-02-29' instead of '2012-01-29' (also impossible date in context)
  • subtract(minutes=24) from 01:01:00 showed '00:00:00' instead of '00:37:00'

frankgoldfish avatar Mar 17 '26 18:03 frankgoldfish