From: Ant Zucaro Date: Tue, 11 Sep 2012 02:01:54 +0000 (-0400) Subject: Add localized time support (on hover). X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=7c5316b773629190d25089000b95c9e6ad6517a0;p=xonotic%2Fxonstat.git Add localized time support (on hover). Without Javascript people will see the UTC time. With Javascript all of those UTC times will be changed to localtime (accounting for DST) via the epoch time of the object. --- diff --git a/xonstat/models.py b/xonstat/models.py index b6ebca1..bbf8bf4 100644 --- a/xonstat/models.py +++ b/xonstat/models.py @@ -39,6 +39,9 @@ class Player(object): def to_dict(self): return {'player_id':self.player_id, 'name':self.nick.encode('utf-8')} + def epoch(self): + return timegm(self.create_dt.timetuple()) + class GameType(object): def __repr__(self): diff --git a/xonstat/templates/base.mako b/xonstat/templates/base.mako index 0386533..3d6af2d 100644 --- a/xonstat/templates/base.mako +++ b/xonstat/templates/base.mako @@ -47,8 +47,20 @@ <%block name="js"> + + + + +