ignore a zero day and its delimiter, in numerical date format

This commit is contained in:
Paul Franklin 2014-11-24 17:15:01 -08:00
parent d6f7cfcd20
commit e84bf70347

View File

@ -455,6 +455,9 @@ class DateDisplay(object):
return str(date_val[2]) return str(date_val[2])
else: else:
value = self._tformat.replace('%m', str(date_val[1])) value = self._tformat.replace('%m', str(date_val[1]))
if date_val[0] == 0: # ignore the zero day and its delimiter
i_day = value.find('%d')
value = value.replace(value[i_day:i_day+3], '')
value = value.replace('%d', str(date_val[0])) value = value.replace('%d', str(date_val[0]))
value = value.replace('%Y', str(abs(date_val[2]))) value = value.replace('%Y', str(abs(date_val[2])))
return value.replace('-', '/') return value.replace('-', '/')