Skip to content
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

Feature request: naturaltime with UTC support or against arbitrary datetimes #46

Closed
ddevault opened this issue Feb 5, 2017 · 4 comments

Comments

@ddevault
Copy link

ddevault commented Feb 5, 2017

humanize.naturaltime(some_date, utc=True)
humanize.naturaltime(some_date, relative_to=datetime.utcnow())
@NotSqrt
Copy link

NotSqrt commented Jun 29, 2017

Quick patch for python3:

from datetime import datetime, timezone
from unittest import mock
from humanize import time as humanize_time

def now():
    return datetime.now(timezone.utc)

def naturaltime(dt):
    if dt.tzinfo is None:
        return humanize_time.naturaltime(dt)
    with mock.patch.object(humanize_time, '_now', side_effect=now):
        return humanize_time.naturaltime(dt)

@hugovk
Copy link
Collaborator

hugovk commented May 3, 2022

🚀 Development has moved to https://github.com/python-humanize/humanize 🚀

Please open new issues at https://github.com/python-humanize/humanize/issues

@hugovk hugovk closed this as completed May 3, 2022
@ddevault
Copy link
Author

ddevault commented May 3, 2022

GitHub has a repo move feature which doesn't shove this burden onto literally everyone who has submitted an issue -_-

@hugovk
Copy link
Collaborator

hugovk commented May 3, 2022

Sorry about that, unfortunately I don't have admin access to this repo, only write, which is also the reason for the move (to be able to set up integrations to help with maintenance): python-humanize/humanize#3).

Luckily there weren't too many issues here.

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

No branches or pull requests

3 participants