Metadata-Version: 2.1
Name: localnow
Version: 0.1.0
Summary: Drop-in replacement for `datetime.datetime.now()` explicitly set with the local timezone.
Home-page: https://github.com/sammosummo/localnow
License: MIT
Keywords: datetime,timezone,local
Author: Sam Mathias
Requires-Python: >=3.6,<4.0
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Project-URL: Documentation, https://github.com/sammosummo/localnow
Project-URL: Repository, https://github.com/sammosummo/localnow
Description-Content-Type: text/markdown

# localnow

## Description

This small Python package is a drop-in replacement for `datetime.datetime.now` that returns the current time in the 
local timezone.

## Usage

Suppose you want the current date and time. You could do this:

```python
import datetime

x = datetime.datetime.now()
```

By default, `x` will be in UTC. `datetime.datetime.now` takes an optional `tz` argument that you can use to specify a
different timezone. However, if you want to use your *local* timezone, wherever that may be, you need an extra step:

```python
import datetime

tz = datetime.datetime.utcnow().astimezone().tzinfo
x = datetime.datetime.now(tz=tz)
```

Personally, I find the `tz = ...` line to be a bit of a distraction and difficult to remember, so I made this package.
It provides a drop-in replacement for `datetime.datetime.now` that is essentially does the same as the code above but
with a little less code:

```python
from localnow import now

x = now()
```

That's it.

## Installation

You can install this package from PyPI:

```bash
pip install localnow
```

## License

MIT


