Check empty value in "date_to_datetime" function
authorThierry Florac <thierry.florac@onf.fr>
Wed, 11 Mar 2015 12:21:50 +0100
changeset 15 79a35932c5cc
parent 14 a4cf46dc5634
child 16 0edbf38973ce
Check empty value in "date_to_datetime" function
src/pyams_utils/date.py
--- a/src/pyams_utils/date.py	Fri Mar 06 18:51:15 2015 +0100
+++ b/src/pyams_utils/date.py	Wed Mar 11 12:21:50 2015 +0100
@@ -65,6 +65,8 @@
     @return: input value converted to datetime
     @rtype: datetime
     """
+    if not value:
+        return None
     if type(value) is datetime:
         return value
     return datetime(value.year, value.month, value.day)