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 pytz
|
||||
|
||||
def now(tz_name="UTC"):
|
||||
t = datetime.datetime.now()
|
||||
tz = pytz.timezone(tz_name)
|
||||
def utcnow():
|
||||
t = datetime.datetime.utcnow()
|
||||
tz = pytz.timezone("UTC")
|
||||
|
||||
return tz.localize(t)
|
||||
|
||||
def now():
|
||||
return utcnow().astimezone()
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
|
|
2
setup.py
2
setup.py
|
@ -5,7 +5,7 @@ setup(
|
|||
version = "0.2.0",
|
||||
author = "Decade",
|
||||
packages = ["dec8"],
|
||||
url = "https://git.decade.cz/decade/dec8/",
|
||||
url = "https://git.decade.cz/decade-public/dec8/",
|
||||
license = "LICENSE",
|
||||
description = "Decadic toolkit.",
|
||||
install_requires = [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue