In order to make my API return proper timezone strings (with proper, I mean any that are not marked "deprecated" in the latest specification; so that the consumer of the API has some guarantee on what the valid values are), I would like to check in pytz
whether a zone-name is deprecated (and even better: which are canonical, and which are aliases).
pytz
has a common_timezones
fields, which, according to the documentation, "doesn’t contain deprecated zones or historical zones, except for a few I’ve deemed in common usage, such as US/Eastern". So it feels this almost does the job, however not quite yet; because indeed "US/Eastern" is deprecated officially.
I could obviously now manually get a list of non-deprecated zones, or keep a list of zones that pytz
considers common_timezones
, but are actually deprecated (note the "such as" in the documentation description above), however this would mean I should update this list manually every time I update pytz.
So the question, is there a way to find out in pytz if a zone(name) is deprecated (or alias / canonical)?