From b308d3f02920cc0488892180eb88539fe4a2a183 Mon Sep 17 00:00:00 2001 From: Kristof Daja Date: Sun, 12 Dec 2021 21:03:13 +0100 Subject: [PATCH] issue/#34: `MinioBackend.get_modified_time()` now respects `USE_TZ` --- django_minio_backend/models.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/django_minio_backend/models.py b/django_minio_backend/models.py index 48542a0..f668a0e 100644 --- a/django_minio_backend/models.py +++ b/django_minio_backend/models.py @@ -288,7 +288,9 @@ def get_modified_time(self, name: str) -> datetime: Return the last modified time (as a datetime) of the file specified by name. The datetime will be timezone-aware if USE_TZ=True. """ - return self.stat(name).last_modified + if get_setting("USE_TZ"): + return self.stat(name).last_modified + return self.stat(name).last_modified.replace(tzinfo=None) # remove timezone info @staticmethod def _guess_content_type(file_path_name: str, content: InMemoryUploadedFile):