Skip to content

Unable to find timezone Yukon Standard Time #660

Closed

Description

@forpassion

Yukon Standard Time is a valid time zone. Please update.
Thank you.
dt1 = pendulum.datetime(2025,5,23,tz='local')
dt1


LookupError Traceback (most recent call last)
Input In [4], in <cell line: 1>()
----> 1 dt1 = pendulum.datetime(2025,5,23,tz='local')
2 dt1

File ~\Anaconda3\lib\site-packages\pendulum_init_.py:111, in datetime(year, month, day, hour, minute, second, microsecond, tz, dst_rule)
107 """
108 Creates a new DateTime instance from a specific date and time.
109 """
110 if tz is not None:
--> 111 tz = _safe_timezone(tz)
113 if not _HAS_FOLD:
114 dt = naive(year, month, day, hour, minute, second, microsecond)

File ~\Anaconda3\lib\site-packages\pendulum_init_.py:74, in _safe_timezone(obj)
71 return obj
73 if obj is None or obj == "local":
---> 74 return local_timezone()
76 if isinstance(obj, (int, float)):
77 obj = int(obj * 60 * 60)

File ~\Anaconda3\lib\site-packages\pendulum\tz_init_.py:60, in local_timezone()
56 def local_timezone(): # type: () -> _Timezone
57 """
58 Return the local timezone.
59 """
---> 60 return get_local_timezone()

File ~\Anaconda3\lib\site-packages\pendulum\tz\local_timezone.py:35, in get_local_timezone()
32 return _mock_local_timezone
34 if _local_timezone is None:
---> 35 tz = _get_system_timezone()
37 _local_timezone = tz
39 return _local_timezone

File ~\Anaconda3\lib\site-packages\pendulum\tz\local_timezone.py:59, in _get_system_timezone()
57 def _get_system_timezone(): # type: () -> Timezone
58 if sys.platform == "win32":
---> 59 return _get_windows_timezone()
60 elif "darwin" in sys.platform:
61 return _get_darwin_timezone()

File ~\Anaconda3\lib\site-packages\pendulum\tz\local_timezone.py:140, in _get_windows_timezone()
138 # Return what we have.
139 if timezone is None:
--> 140 raise LookupError("Unable to find timezone " + tzkeyname)
142 return Timezone(timezone)

LookupError: Unable to find timezone Yukon Standard Time

  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the documentation and believe that my question is not covered.

Feature Request

Activity

  1. NickFabry commented on May 5, 2023

    @NickFabry
    Collaborator

    In fact, "Yukon Standard Time" is not well defined. You can see the references for this assertion here:

    https://en.m.wikipedia.org/wiki/Yukon_Time_Zone
    https://www.iana.org/time-zones

    Also, as documented in https://pendulum.eustace.io/docs/#instantiation , pendulum uses the IANA zoneinfo to define time zones. These are named by the continent holding containing the zone, followed by a / and the name of the largest city in that zone; you probably want something like America/Whitehorse or America/Inuvik.

    If you want the long and gnarly history of time in the Yukon, look inside the IANA file 'northamerica' for more details.

  2. forpassion commented on May 5, 2023

    @forpassion
    Author
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions