Browse Source

Fixed datetime not having correct timezone

pull/10/head
Kenneth Bruen 3 years ago
parent
commit
e68709092b
Signed by: kbruen
GPG Key ID: C1980A470C3EE5B1
  1. 4
      server/foxbank_server/apis/notifications.py
  2. 4
      server/foxbank_server/apis/transactions.py

4
server/foxbank_server/apis/notifications.py

@ -1,4 +1,4 @@
from datetime import datetime
from datetime import datetime, timezone
from flask.views import MethodView
from flask_smorest import Blueprint
from marshmallow import Schema, fields
@ -41,7 +41,7 @@ class NotificationsList(MethodView):
The usefulness of this endpoint is questionable besides debugging since it's a notification to self
"""
now = datetime.now()
now = datetime.now(timezone.utc).astimezone()
notification = Notification.new_notification(body, now, read)
insert_notification(decorators.user_id, notification)
return returns.success(notification=notification)

4
server/foxbank_server/apis/transactions.py

@ -1,4 +1,4 @@
from datetime import date, datetime
from datetime import date, datetime, timezone
from flask.views import MethodView
from flask_smorest import Blueprint
from marshmallow import Schema, fields
@ -75,7 +75,7 @@ class TransactionsList(MethodView):
if not check_iban(destination_iban):
return returns.abort(returns.INVALID_IBAN)
date = datetime.now()
date = datetime.now(timezone.utc).astimezone()
# Check if transaction is to another FoxBank account
reverse_transaction = None

Loading…
Cancel
Save