Skip to content

Update docstring in naturaldelta #242

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 16, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions src/humanize/time.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,18 @@ def naturaldelta(
Examples:
Compare two timestamps in a custom local timezone::

import datetime as dt
from dateutil.tz import gettz
```pycon
>>> import datetime as dt
>>> from dateutil.tz import gettz

berlin = gettz("Europe/Berlin")
now = dt.datetime.now(tz=berlin)
later = now + dt.timedelta(minutes=30)
>>> berlin = gettz("Europe/Berlin")
>>> now = dt.datetime.now(tz=berlin)
>>> later = now + dt.timedelta(minutes=30)

>>> assert naturaldelta(later - now) == "30 minutes"
True
```

assert naturaldelta(later - now) == "30 minutes"
"""
import datetime as dt

Expand Down
Loading