Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

Fix: convert file mtime to the configured time zone directly (#14249)

Trenton Habf5050ea700
diff --git a/src/documents/consumer.py b/src/documents/consumer.py
index edb48c348..4f321d88e 100644
--- a/src/documents/consumer.py
+++ b/src/documents/consumer.py
@@ -857,8 +857,9 @@ class ConsumerPlugin(
self.log.debug(f"Creation date from parse_date: {create_date}")
else:
stats = Path(self.input_doc.original_file).stat()
- create_date = timezone.make_aware(
- datetime.datetime.fromtimestamp(stats.st_mtime),
+ create_date = datetime.datetime.fromtimestamp(
+ stats.st_mtime,
+ tz=timezone.get_current_timezone(),
)
self.log.debug(f"Creation date from st_mtime: {create_date}")