Skip to content

Commit cf5b380

Browse files
committed
Format comment timestamps according to users preferences.
1 parent aa945a8 commit cf5b380

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

code_comments/comment.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

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

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

136134
def get_ticket_relations(self):
137135
query = """

0 commit comments

Comments
 (0)