try to avoid ValueError because of erroneous date

This commit is contained in:
Helmut Merz 2016-04-05 08:57:32 +02:00
parent c7059e4f52
commit b988ec0f32

View file

@ -304,7 +304,10 @@ class DateFieldInstance(NumberFieldInstance):
return ''
if isinstance(value, basestring):
return value
return strftime('%Y-%m-%dT%H:%M', value.timetuple())
try:
return strftime('%Y-%m-%dT%H:%M', value.timetuple())
except ValueError:
return ''
def display(self, value):
if value is None: