mirror of
https://gitlab.com/SIGBUS/nyaa.git
synced 2024-12-22 10:10:00 +00:00
Fix timezone awareness for account creation time (#378)
This commit is contained in:
parent
1e5f61ddf7
commit
19eaa2c532
|
@ -606,6 +606,11 @@ class User(db.Model):
|
|||
'''Account age in seconds'''
|
||||
return (datetime.utcnow() - self.created_time).total_seconds()
|
||||
|
||||
@property
|
||||
def created_utc_timestamp(self):
|
||||
''' Returns a UTC POSIX timestamp, as seconds '''
|
||||
return (self.created_time - UTC_EPOCH).total_seconds()
|
||||
|
||||
|
||||
class AdminLogBase(DeclarativeHelperBase):
|
||||
__tablename_base__ = 'adminlog'
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
<dt>User ID:</dt>
|
||||
<dd>{{ user.id }}</dd>
|
||||
<dt>Account created on:</dt>
|
||||
<dd>{{ user.created_time }}</dd>
|
||||
<dd data-timestamp="{{ user.created_utc_timestamp|int }}">{{ user.created_time.strftime('%Y-%m-%d %H:%M UTC') }}</dd>
|
||||
<dt>Email address:</dt>
|
||||
<dd>{{ user.email }}</dd>
|
||||
<dt>User class:</dt>
|
||||
|
|
Loading…
Reference in a new issue