summaryrefslogtreecommitdiff
path: root/django/db/backends/postgresql/operations.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/db/backends/postgresql/operations.py')
-rw-r--r--django/db/backends/postgresql/operations.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/django/db/backends/postgresql/operations.py b/django/db/backends/postgresql/operations.py
index 8d19872bea..399c1b24e7 100644
--- a/django/db/backends/postgresql/operations.py
+++ b/django/db/backends/postgresql/operations.py
@@ -2,6 +2,7 @@ from psycopg2.extras import Inet
from django.conf import settings
from django.db.backends.base.operations import BaseDatabaseOperations
+from django.db.backends.utils import split_tzname_delta
class DatabaseOperations(BaseDatabaseOperations):
@@ -44,10 +45,10 @@ class DatabaseOperations(BaseDatabaseOperations):
return "DATE_TRUNC('%s', %s)" % (lookup_type, field_name)
def _prepare_tzname_delta(self, tzname):
- if '+' in tzname:
- return tzname.replace('+', '-')
- elif '-' in tzname:
- return tzname.replace('-', '+')
+ tzname, sign, offset = split_tzname_delta(tzname)
+ if offset:
+ sign = '-' if sign == '+' else '+'
+ return f'{tzname}{sign}{offset}'
return tzname
def _convert_field_to_tz(self, field_name, tzname):