summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--date.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/date.py b/date.py
index 0dbbf51..b069a6f 100644
--- a/date.py
+++ b/date.py
@@ -304,9 +304,13 @@ def ustrftime(somedate, fmt='%Y-%m-%d'):
return unicode(fmt) % fields
def utcdatetime(dt):
+ if dt.tzinfo is None:
+ return dt
return datetime(*dt.utctimetuple()[:7])
def utctime(dt):
+ if dt.tzinfo is None:
+ return dt
return (dt + dt.utcoffset() + dt.dst()).replace(tzinfo=None)
def datetime_to_seconds(date):