Skip to content

Commit

Permalink
issue/#34: MinioBackend.get_modified_time() now respects USE_TZ
Browse files Browse the repository at this point in the history
  • Loading branch information
theriverman committed Dec 12, 2021
1 parent fab43af commit b308d3f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion django_minio_backend/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit b308d3f

Please sign in to comment.