summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorJoe Jackson <cpmhjoe@gmail.com>2020-08-29 14:40:54 -0400
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2020-09-02 07:42:27 +0200
commit9d5d865fd6e989abe60fdf02e7f97fd4d98178a4 (patch)
treea2026e2afe2c73c4e149de3cde0a3dbf050c2ae1 /django
parent76e0151ea0e0f56dca66cee846a78b89346d2c4c (diff)
Fixed #31948 -- Added tzinfo parameter to TruncDate() and TruncTime().
Diffstat (limited to 'django')
-rw-r--r--django/db/models/functions/datetime.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/django/db/models/functions/datetime.py b/django/db/models/functions/datetime.py
index b6594b043b..6828980733 100644
--- a/django/db/models/functions/datetime.py
+++ b/django/db/models/functions/datetime.py
@@ -292,7 +292,7 @@ class TruncDate(TruncBase):
def as_sql(self, compiler, connection):
# Cast to date rather than truncate to date.
lhs, lhs_params = compiler.compile(self.lhs)
- tzname = timezone.get_current_timezone_name() if settings.USE_TZ else None
+ tzname = self.get_tzname()
sql = connection.ops.datetime_cast_date_sql(lhs, tzname)
return sql, lhs_params
@@ -305,7 +305,7 @@ class TruncTime(TruncBase):
def as_sql(self, compiler, connection):
# Cast to time rather than truncate to time.
lhs, lhs_params = compiler.compile(self.lhs)
- tzname = timezone.get_current_timezone_name() if settings.USE_TZ else None
+ tzname = self.get_tzname()
sql = connection.ops.datetime_cast_time_sql(lhs, tzname)
return sql, lhs_params