From f1cdb291e5b63e69350ed7c7ecb78d143f544b14 Mon Sep 17 00:00:00 2001 From: Seblu <sebastien.luttringer@smartjog.com> Date: Tue, 12 Apr 2011 12:23:38 +0200 Subject: [PATCH] make date/time tagdisplay convertion only if decimal --- cccli/tagdisplay.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/cccli/tagdisplay.py b/cccli/tagdisplay.py index b357b84..2cee658 100644 --- a/cccli/tagdisplay.py +++ b/cccli/tagdisplay.py @@ -149,15 +149,21 @@ class TagDisplay(object): def type_date(self, value): '''date type''' - d = datetime.datetime.fromtimestamp(float(value)) - return d.strftime("%d/%m/%Y") + if value.isdecimal(): + d = datetime.datetime.fromtimestamp(float(value)) + return d.strftime("%d/%m/%Y") + return value def type_time(self, value): '''date type''' - d = datetime.datetime.fromtimestamp(float(value)) - return d.strftime("%H:%M:%S") + if value.isdecimal(): + d = datetime.datetime.fromtimestamp(float(value)) + return d.strftime("%H:%M:%S") + return value def type_datetime(self, value): '''date type''' - d = datetime.datetime.fromtimestamp(float(value)) - return d.strftime("%d/%m/%Y %H:%M:%S") + if value.isdecimal(): + d = datetime.datetime.fromtimestamp(float(value)) + return d.strftime("%d/%m/%Y %H:%M:%S") + return value -- GitLab