changed datetime.utcnow() to datetime.now() to give local time

This commit is contained in:
nberting 2018-06-13 23:09:43 +02:00
parent 0b70070c1f
commit 1b9baec128
3 changed files with 8 additions and 8 deletions

View File

@ -111,11 +111,11 @@ class Chat(db.Model):
id = db.Column(db.Integer(), primary_key=True)
message = db.Column(db.String(1000))
time = Column(DateTime, default=datetime.datetime.utcnow)
time = Column(DateTime, default=datetime.datetime.now)
def __init__(self, message):
self.message = message
self.time = datetime.datetime.utcnow()
self.time = datetime.datetime.now()
class Stack(db.Model):
__tablename__ = 'stacks'
@ -138,11 +138,11 @@ class Potential(db.Model):
__tablename__ = 'potential'
id = db.Column(db.Integer, primary_key = True)
ptitle = db.Column(db.String(50))
time = db.Column(DateTime, default=datetime.datetime.utcnow())
time = db.Column(DateTime, default=datetime.datetime.now())
def __init__(self, ptitle):
self.ptitle = ptitle
self.time = datetime.datetime.utcnow()
self.time = datetime.datetime.now()
class AuthorSchema(Schema):

View File

@ -128,7 +128,7 @@
{% endif %}
{% endfor %}
{%else%}<div style="padding-bottom:50px;"><i> No annotations yet for this book </i></div>
{%else%}<div style="padding-bottom:70px;"><i> No annotations yet for this book </i></div>
{%endif%}
</div>
<hr>

View File

@ -572,7 +572,7 @@ def show_books():
socketio.emit('channel-' + str(1), {
'username': 'Search form',
'text': search.search.data,
'time': str(datetime.datetime.utcnow().strftime("%d.%m.%Y %H:%M"))}, broadcast=True)
'time': str(datetime.datetime.now().strftime("%d.%m.%Y %H:%M"))}, broadcast=True)
# Save message
my_new_chat = Chat(message=newmsg)
db.session.add(my_new_chat)
@ -638,7 +638,7 @@ def search_results(searchtype, query, viewby):
socketio.emit('channel-' + str(1), {
'username': 'Search form',
'text': search.search.data,
'time': str(datetime.datetime.utcnow().strftime("%d.%m.%Y %H:%M"))}, broadcast=True)
'time': str(datetime.datetime.now().strftime("%d.%m.%Y %H:%M"))}, broadcast=True)
# Save message
my_new_chat = Chat(message=newmsg)
db.session.add(my_new_chat)
@ -885,7 +885,7 @@ def new_message(message):
emit('channel-' + str(message['channel']), {
'username': message['username'],
'text': message['text'],
'time': str(datetime.datetime.utcnow().strftime("%d.%m.%Y %H:%M"))
'time': str(datetime.datetime.now().strftime("%d.%m.%Y %H:%M"))
},
broadcast=True
)