MCPcopy
hub / github.com/django/django / now

Method now

tests/humanize_tests/tests.py:22–27  ·  view source on GitHub ↗
(cls, tz=None)

Source from the content-addressed store, hash-verified

20class MockDateTime(datetime.datetime):
21 @classmethod
22 def now(cls, tz=None):
23 if tz is None or tz.utcoffset(now) is None:
24 return now
25 else:
26 # equals now.replace(tzinfo=utc)
27 return now.replace(tzinfo=tz) + tz.utcoffset(now)
28
29
30@modify_settings(INSTALLED_APPS={"append": "django.contrib.humanize"})

Callers 15

_get_session_from_dbMethod · 0.45
_aget_session_from_dbMethod · 0.45
clear_expiredMethod · 0.45
aclear_expiredMethod · 0.45
get_expiry_ageMethod · 0.45
aget_expiry_ageMethod · 0.45
get_expiry_dateMethod · 0.45
aget_expiry_dateMethod · 0.45
set_expiryMethod · 0.45
aset_expiryMethod · 0.45
update_last_loginFunction · 0.45
_nowMethod · 0.45

Calls 1

utcoffsetMethod · 0.45

Tested by

no test coverage detected