Metadata-Version: 2.1
Name: timezone_tools
Version: 0.1.0
Summary: Tools for working with timezone-aware datetimes.
License: BSD 3-Clause License
        
        Copyright (c) 2024, Kraken Technologies Limited
        
        Redistribution and use in source and binary forms, with or without
        modification, are permitted provided that the following conditions are met:
        
        1. Redistributions of source code must retain the above copyright notice, this
           list of conditions and the following disclaimer.
        
        2. Redistributions in binary form must reproduce the above copyright notice,
           this list of conditions and the following disclaimer in the documentation
           and/or other materials provided with the distribution.
        
        3. Neither the name of the copyright holder nor the names of its
           contributors may be used to endorse or promote products derived from
           this software without specific prior written permission.
        
        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
        AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
        DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
        FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
        SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
        CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
        OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
        OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
        
Project-URL: Source, https://github.com/octoenergy/timezone-tools
Project-URL: Changelog, https://github.com/octoenergy/timezone-tools/blob/main/CHANGELOG.md
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: python-dateutil
Requires-Dist: typing_extensions
Provides-Extra: dev
Requires-Dist: covdefaults; extra == "dev"
Requires-Dist: coverage; extra == "dev"
Requires-Dist: pre-commit; extra == "dev"
Requires-Dist: pytest; extra == "dev"
Requires-Dist: time-machine; extra == "dev"
Requires-Dist: tox; extra == "dev"
Requires-Dist: tox-uv; extra == "dev"
Requires-Dist: uv; extra == "dev"

# timezone-tools

Helpers for working with timezone-aware date-times.

This package provides:

- `TimezoneConverter`
  for making date-times timezone-aware
  and converting between timezones.
- `Clock`
  for getting the current time/date
  in a specific timezone.

## `TimezoneConverter`

This converter object can be used
to create timezone-aware `datetime` objects,
to make a naive `datetime` timezone-aware,
and to localize other timezone-aware `datetime` objects.

The converter also provides utilities
for converting a `datetime` into a `date` in the converter's timezone,
calculating dates and time relative to a `datetime`,
and rounding a `datetime` to the nearest increment of time
(e.g. to the nearest half-hour).

Create an instance of the timezone converter
by passing it an IANA time zone name.

```python
from timezone_tools import TimezoneConverter

paris_time = TimezoneConverter("Europe/Paris")
```

For more information about timezone support in Python,
see the [documentation for the `zoneinfo` module](https://docs.python.org/3/library/zoneinfo.html).

## `Clock`

This clock object can be used
to access the system clock
and provides timezone-aware dates and times.

The clock also provides utilities
for calculating dates and time relative to the current moment.

Create an instance of the clock
by passing it an IANA time zone name.

```python
from timezone_tools import Clock

paris_time = Clock("Europe/Paris")
```

For more information about timezone support in Python,
see the [documentation for the `zoneinfo` module](https://docs.python.org/3/library/zoneinfo.html).
