Skip to content

Commit

Permalink
fix compare device export
Browse files Browse the repository at this point in the history
  • Loading branch information
cayop committed Nov 20, 2023
1 parent a0f68c4 commit fc6cfea
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ereuse_devicehub/resources/device/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import os
import pathlib
import uuid
import psycopg2
from contextlib import suppress
from datetime import datetime
from fractions import Fraction
Expand Down Expand Up @@ -1101,7 +1102,11 @@ def close_device(self, date, normalize="%Y-%m-%d_%H_%M"):

if isinstance(date, str):
try:
self._date_close = datetime.strptime(date, normalize)
self._date_close = datetime.strptime(date, normalize).replace(
tzinfo=psycopg2.tz.FixedOffsetTimezone(offset=60, name=None)
)
if self._date_close < self.created:
self._date_close = self.created.replace(hour=23, minute=59)
except Exception as err:
logger.error(err)
txt = "Date: {} normalize: {}".format(date, normalize)
Expand Down

0 comments on commit fc6cfea

Please sign in to comment.