Opened 2 years ago

Closed 2 years ago

#33663 closed Bug (duplicate)

Timezones with hyphens in name fail in Extract() functions.

Reported by: Doug Franklin Owned by: nobody
Component: Database layer (models, ORM) Version: 4.0
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

local_tz = pytz.timezone(""Asia/Ust-Nera")
Model.objects.annotate(
    created_at_month=ExtractMonth('created_at', tzinfo=local_tz)
)

Fails with:

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

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;

Change History (1)

comment:1 by Mariusz Felisiak, 2 years ago

Component: UncategorizedDatabase layer (models, ORM)
Resolution: duplicate
Status: newclosed
Type: UncategorizedBug

Duplicate of #33279.

Note: See TracTickets for help on using tickets.
Back to Top