Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: replace pytz usage to zoneinfo in documentation #676

Merged
merged 1 commit into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Minor changes:
- Make coverage report submission optional for pull requests
- Rename ``master`` branch to ``main``, see `Issue
<https://github.com/collective/icalendar/issues/627>`_
- Update ``docs/usage.rst`` to use zoneinfo instead of pytz.
- Added missing public classes and functions to API documentation.
- Improved namespace management in the ``icalendar`` directory.
- Add Python version badge and badge for test coverage
Expand Down
12 changes: 6 additions & 6 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,10 @@ Property parameters are automatically added, depending on the input value. For
example, for date/time related properties, the value type and timezone
identifier (if applicable) are automatically added here::

>>> import pytz
>>> import zoneinfo
>>> event = Event()
>>> event.add('dtstart', datetime(2010, 10, 10, 10, 0, 0,
... tzinfo=pytz.timezone("Europe/Vienna")))
... tzinfo=zoneinfo.ZoneInfo("Europe/Vienna")))

>>> lines = event.to_ical().splitlines()
>>> assert (
Expand Down Expand Up @@ -262,7 +262,7 @@ Init the calendar::

>>> cal = Calendar()
>>> from datetime import datetime
>>> import pytz
>>> import zoneinfo

Some properties are required to be compliant::

Expand All @@ -273,9 +273,9 @@ We need at least one subcomponent for a calendar to be compliant::

>>> event = Event()
>>> event.add('summary', 'Python meeting about calendaring')
>>> event.add('dtstart', datetime(2005,4,4,8,0,0,tzinfo=pytz.utc))
>>> event.add('dtend', datetime(2005,4,4,10,0,0,tzinfo=pytz.utc))
>>> event.add('dtstamp', datetime(2005,4,4,0,10,0,tzinfo=pytz.utc))
>>> event.add('dtstart', datetime(2005,4,4,8,0,0,tzinfo=zoneinfo.ZoneInfo("UTC")))
>>> event.add('dtend', datetime(2005,4,4,10,0,0,tzinfo=zoneinfo.ZoneInfo("UTC")))
>>> event.add('dtstamp', datetime(2005,4,4,0,10,0,tzinfo=zoneinfo.ZoneInfo("UTC")))

A property with parameters. Notice that they are an attribute on the value::

Expand Down