Search code examples
pythondatetimetimezonepytz

Timezone obtained via TimezoneFinder, 'America/Ciudad_Juarez', generates error UnknowTimeZone with pytz


I retrieve timezones from airports of the world, using TimezoneFinder().timezone_at applied on longitude and latitude of airports. And when I want to use these timezones (to compute times of departure ad arrival of flights) everything works except America/Ciudad_Juarez. This simple code:

from timezonefinder import TimezoneFinder
from pytz import timezone
tz = TimezoneFinder().timezone_at(lng=-106.48333, lat=31.73333)
# retrieves 'America/Ciudad_Juarez'
timezone(tz)

Generates this error:

UnknownTimeZoneError: 'America/Ciudad_Juarez'

I checked in this excellent wikipedia page, this timezone is correct, canonical they say. I am surprised that a timezone obtained through timezonefinder is not recognised by pytz. How can I cleanly solve this?


Solution

  • This timezone was only very recently added, as Ciudad Juárez decided to align it's time with the US for DST. See http://mm.icann.org/pipermail/tz-announce/2022-November/000076.html for the announcement. It looks like pytz has not been updated to include that change just yet.