[Django] #33664: Timezones with hyphens in name fail in Extract() functions.

10 views
Skip to first unread message

Django

unread,
Apr 27, 2022, 12:42:14 AM4/27/22
to django-...@googlegroups.com
#33664: Timezones with hyphens in name fail in Extract() functions.
-------------------------------------+-------------------------------------
Reporter: Doug | Owner: nobody
Franklin |
Type: | Status: new
Uncategorized |
Component: | Version: 3.2
Uncategorized | Keywords: timezone extract
Severity: Normal | hyphen
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
{{{
local_tz = pytz.timezone(""Asia/Ust-Nera")
models = Model.objects.annotate(
created_at_month=ExtractMonth('created_at', tzinfo=local_tz)
)
}}}

When evaluating the queryset it fails with:


{{{
DataError: time zone "Asia/Ust+Nera" not recognized
}}}

The "+" in "Asia/Ust+Nera" is suspicious.I have confirmed this fails with
other timezones with hyphens, such as "America/Port-au-Prince".

I have also confirmed my postgresql DB supports these timezones:

{{{
SELECT
name,
abbrev,
utc_offset,
is_dst
FROM pg_timezone_names
WHERE name !~ 'posix'
ORDER BY name asc;
}}}
{{{
```
Asia/Ust-Nera | +10 | 10:00:00 | f
...
America/Port-au-Prince | EDT | -04:00:00 | t
```
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/33664>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Apr 27, 2022, 2:48:18 AM4/27/22
to django-...@googlegroups.com
#33664: Timezones with hyphens in name fail in Extract() functions.
-------------------------------------+-------------------------------------
Reporter: Doug Franklin | Owner: nobody
Type: Bug | Status: closed
Component: Database layer | Version: 3.2
(models, ORM) |
Severity: Normal | Resolution: duplicate
Keywords: timezone extract | Triage Stage:
hyphen | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* status: new => closed
* resolution: => duplicate
* component: Uncategorized => Database layer (models, ORM)
* type: Uncategorized => Bug


Comment:

Duplicate of #33663.

--
Ticket URL: <https://code.djangoproject.com/ticket/33664#comment:1>

Reply all
Reply to author
Forward
0 new messages