Fix naive timezones

This commit is contained in:
Antoine Merino 2021-11-06 13:09:15 +01:00
parent da4344d216
commit 3c33b48fd5
No known key found for this signature in database
GPG Key ID: E53AF74E9DC0C53E

View File

@ -293,7 +293,7 @@ class RPC:
def _rpc_weekly_profit( def _rpc_weekly_profit(
self, timescale: int, self, timescale: int,
stake_currency: str, fiat_display_currency: str) -> Dict[str, Any]: stake_currency: str, fiat_display_currency: str) -> Dict[str, Any]:
today = datetime.utcnow().date() today = datetime.now(timezone.utc).date()
first_iso_day_of_week = today - timedelta(days=today.weekday()) # Monday first_iso_day_of_week = today - timedelta(days=today.weekday()) # Monday
profit_weeks: Dict[date, Dict] = {} profit_weeks: Dict[date, Dict] = {}
@ -336,7 +336,7 @@ class RPC:
def _rpc_monthly_profit( def _rpc_monthly_profit(
self, timescale: int, self, timescale: int,
stake_currency: str, fiat_display_currency: str) -> Dict[str, Any]: stake_currency: str, fiat_display_currency: str) -> Dict[str, Any]:
first_day_of_month = datetime.utcnow().date().replace(day=1) first_day_of_month = datetime.now(timezone.utc).date().replace(day=1)
profit_months: Dict[date, Dict] = {} profit_months: Dict[date, Dict] = {}
if not (isinstance(timescale, int) and timescale > 0): if not (isinstance(timescale, int) and timescale > 0):