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

Add code block in hikari.embeds's docs #1667

Merged
merged 3 commits into from
Jul 23, 2023
Merged
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
10 changes: 8 additions & 2 deletions hikari/embeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,8 @@ def timestamp(self) -> typing.Optional[datetime.datetime]:
To generate a timezone aware timestamp, use one of the following
snippets:

.. code-block:: python

# Use UTC.
>>> datetime.datetime.now(tz=datetime.timezone.utc)
datetime.datetime(2020, 6, 5, 18, 29, 56, 424744, tzinfo=datetime.timezone.utc)
Expand All @@ -440,7 +442,9 @@ def timestamp(self) -> typing.Optional[datetime.datetime]:

You can generate a timezone-aware timestamp instead of a timezone-naive
one by specifying a timezone. Hikari will detect any difference in
timezone if the timestamp is non timezone-naive and fix it for you.
timezone if the timestamp is non timezone-naive and fix it for you:

.. code-block:: python

# I am British, and it is June, so we are in daylight saving
# (UTC+1 or GMT+1, specifically).
Expand All @@ -463,7 +467,9 @@ def timestamp(self) -> typing.Optional[datetime.datetime]:
>>> ...

A library on PyPI called [tzlocal](...) also exists that may be useful
to you if you need to get your local timezone for any reason.
to you if you need to get your local timezone for any reason:

.. code-block:: python

>>> import datetime
>>> import tzlocal
Expand Down
Loading