fix dt.now returning broken timezones
This commit is contained in:
parent
10d356225d
commit
849388f56c
2 changed files with 7 additions and 4 deletions
|
@ -6,11 +6,14 @@
|
||||||
import datetime
|
import datetime
|
||||||
import pytz
|
import pytz
|
||||||
|
|
||||||
def now(tz_name="UTC"):
|
def utcnow():
|
||||||
t = datetime.datetime.now()
|
t = datetime.datetime.utcnow()
|
||||||
tz = pytz.timezone(tz_name)
|
tz = pytz.timezone("UTC")
|
||||||
|
|
||||||
return tz.localize(t)
|
return tz.localize(t)
|
||||||
|
|
||||||
|
def now():
|
||||||
|
return utcnow().astimezone()
|
||||||
|
|
||||||
# ----------------------------------------------------------------
|
# ----------------------------------------------------------------
|
||||||
|
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -5,7 +5,7 @@ setup(
|
||||||
version = "0.2.0",
|
version = "0.2.0",
|
||||||
author = "Decade",
|
author = "Decade",
|
||||||
packages = ["dec8"],
|
packages = ["dec8"],
|
||||||
url = "https://git.decade.cz/decade/dec8/",
|
url = "https://git.decade.cz/decade-public/dec8/",
|
||||||
license = "LICENSE",
|
license = "LICENSE",
|
||||||
description = "Decadic toolkit.",
|
description = "Decadic toolkit.",
|
||||||
install_requires = [
|
install_requires = [
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue