#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.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701806953a330-a84ec518-9f78-4c9b-ab9d-ff17028d2b98-000000%40eu-central-1.amazonses.com.

Reply via email to