1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-24 04:48:03 +00:00

Modify group message time format

This commit is contained in:
xiez
2012-06-27 20:22:42 +08:00
parent 1be271353e
commit c824155ac7
3 changed files with 7 additions and 3 deletions

View File

@@ -46,7 +46,11 @@ def translate_commit_desc(value):
def translate_commit_time(value):
"""Translate commit time to human frindly format instead of timestamp"""
limit = 14 * 24 * 60 * 60 # Timestamp with in two weeks will be translated
val = datetime.fromtimestamp(value)
if hasattr(value, 'strftime'):
val = datetime.fromtimestamp(int(value.strftime("%s")))
else:
val = datetime.fromtimestamp(value)
now = datetime.now()
delta = now - (val - dt.timedelta(0, 0, val.microsecond))