Skip to content

Commit

Permalink
Format comment timestamps according to users preferences.
Browse files Browse the repository at this point in the history
  • Loading branch information
SebDieBln committed Sep 22, 2019
1 parent 3d99bf6 commit cf6ac4b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions code_comments/comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import trac.wiki.formatter
from trac.mimeview.api import Context
from time import strftime, localtime
from trac.util.datefmt import format_datetime, user_time
from code_comments import db
from trac.util import Markup
from trac.web.href import Href
Expand Down Expand Up @@ -129,9 +129,7 @@ def path_link_tag(self):
return Markup('<a href="%s">%s</a>' % (self.href(), self.link_text()))

def formatted_date(self):
encoding = locale.getlocale()[1] if locale.getlocale()[1] else 'utf-8'
return strftime('%d %b %Y, %H:%M',
localtime(self.time)).decode(encoding)
return user_time(self.req, format_datetime, self.time, '%x %X')

def get_ticket_relations(self):
query = """
Expand Down

0 comments on commit cf6ac4b

Please sign in to comment.