summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAarni Koskela <akx@iki.fi>2022-01-25 15:30:30 +0200
committerAarni Koskela <akx@iki.fi>2022-01-25 15:30:30 +0200
commit0531bc9e17879f64c6f89e355905ea4037cbbf8a (patch)
tree1abe73cb1a2f7e4671f409ff4153d1b6863c4087
parent227d1ec9e44bb95fb77fe5611815cc13be27e164 (diff)
downloadbabel-0531bc9e17879f64c6f89e355905ea4037cbbf8a.tar.gz
Improve documentation for TimezoneTransition
Fixes #823
-rw-r--r--babel/dates.py15
-rw-r--r--docs/api/dates.rst2
2 files changed, 12 insertions, 5 deletions
diff --git a/babel/dates.py b/babel/dates.py
index 816149d..f94c60a 100644
--- a/babel/dates.py
+++ b/babel/dates.py
@@ -255,17 +255,22 @@ def get_next_timezone_transition(zone=None, dt=None):
class TimezoneTransition(object):
"""A helper object that represents the return value from
:func:`get_next_timezone_transition`.
+
+ :field activates:
+ The time of the activation of the timezone transition in UTC.
+ :field from_tzinfo:
+ The timezone from where the transition starts.
+ :field to_tzinfo:
+ The timezone for after the transition.
+ :field reference_date:
+ The reference date that was provided. This is the `dt` parameter
+ to the :func:`get_next_timezone_transition`.
"""
def __init__(self, activates, from_tzinfo, to_tzinfo, reference_date=None):
- #: the time of the activation of the timezone transition in UTC.
self.activates = activates
- #: the timezone from where the transition starts.
self.from_tzinfo = from_tzinfo
- #: the timezone for after the transition.
self.to_tzinfo = to_tzinfo
- #: the reference date that was provided. This is the `dt` parameter
- #: to the :func:`get_next_timezone_transition`.
self.reference_date = reference_date
@property
diff --git a/docs/api/dates.rst b/docs/api/dates.rst
index f3e59b6..55ea2b1 100644
--- a/docs/api/dates.rst
+++ b/docs/api/dates.rst
@@ -42,6 +42,8 @@ Timezone Functionality
A timezone object for the computer's local timezone.
+.. autoclass:: TimezoneTransition
+
Data Access
-----------