Fix bug where rearranging as timezone was not working if the Date Created format was changed to be timezone-naive.

This commit is contained in:
AccentuSoft
2023-04-17 05:21:33 +03:00
parent e7d1d8a075
commit 83b39fd8b7

View File

@@ -1697,6 +1697,9 @@ class CanvasScene(QtWidgets.QGraphicsScene):
# Should never happen, but we will handle it if it does.
self.parent().mainWindow.MESSAGEHANDLER.warning(f'Entity without valid Date Created: {str(node)}')
entityDate = datetime.now().replace(microsecond=0, second=0)
if entityDate.tzinfo is None or entityDate.tzinfo.utcoffset(entityDate) is None:
# Make timezone-naive objects into timezone-aware, with the user's current timezone.
entityDate = entityDate.replace(tzinfo=datetime.now().astimezone().tzinfo)
if entityDate not in nodesOnCanvas:
nodesOnCanvas[entityDate] = [node]
else: