--- a/docs/HISTORY.txt Tue Apr 23 11:16:12 2013 +0200
+++ b/docs/HISTORY.txt Tue May 07 15:41:57 2013 +0200
@@ -5,6 +5,7 @@
-----
- small correction in getHumanSize() function
- added dates formatting functions
+ - added check between date and datetime types in timezone module
0.4.1
-----
--- a/src/ztfy/utils/timezone/__init__.py Tue Apr 23 11:16:12 2013 +0200
+++ b/src/ztfy/utils/timezone/__init__.py Tue May 07 15:41:57 2013 +0200
@@ -17,6 +17,7 @@
# import standard packages
import pytz
+from datetime import date
# import Zope3 interfaces
from zope.interface.common.idatetime import ITZInfo
@@ -48,6 +49,8 @@
def tztime(value):
if not value:
return None
+ if isinstance(value, date):
+ return value
if not value.tzinfo:
value = GMT.localize(value)
return value.astimezone(tzinfo())
@@ -56,6 +59,8 @@
def gmtime(value):
if not value:
return None
+ if isinstance(value, date):
+ return value
if not value.tzinfo:
value = GMT.localize(value)
return value.astimezone(GMT)