set timezone of scanned creation time

This commit is contained in:
Stefan Allius
2025-05-13 00:34:22 +02:00
parent 7aab01bcfc
commit cb9344a476

View File

@@ -6,6 +6,7 @@ from cnf.config import Config
from datetime import datetime
from os import DirEntry
import os
from dateutil import tz
from . import web
@@ -19,10 +20,10 @@ def _get_birth_from_log(path: str) -> None | datetime:
first_line = first_line.lstrip("'")
fmt = "%Y-%m-%d %H:%M:%S" if first_line[4] == '-' \
else "%d-%m-%Y %H:%M:%S"
dt = datetime.strptime(first_line[0:19], fmt)
dt = datetime.strptime(first_line[0:19], fmt). \
replace(tzinfo=tz.tzlocal())
except Exception:
pass
# print(f"except: '{e}' for {first_line}")
return dt