Metadata-Version: 2.1
Name: relative-to-now
Version: 1.1.0
Summary: Print a datetime's distance from now
Home-page: https://github.com/Riverside-Healthcare/RelativeToNow
License: GPL-3.0-or-later
Author: Christopher Pickering
Author-email: cpickering@rhc.net
Maintainer: Christopher Pickering
Maintainer-email: cpickering@rhc.net
Requires-Python: >=3.7.2,<4.0.0
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
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
Project-URL: Documentation, https://github.com/Riverside-Healthcare/RelativeToNow
Project-URL: Repository, https://github.com/Riverside-Healthcare/RelativeToNow
Description-Content-Type: text/markdown


<h1 align="center">Relative To Now</h1>

<h4 align="center">Convert date/time into a string relative to now.</h4>

<p align="center">
  <a href="https://pypi.org/project/relative-to-now/">
    <img src="https://img.shields.io/badge/Python-3.7%20%7C%203.8%20%7C%203.9-blue" alt="Python Version">
  </a>
  <a href="https://codecov.io/gh/Riverside-Healthcare/RelativeToNow">
    <img src="https://codecov.io/gh/Riverside-Healthcare/RelativeToNow/branch/master/graph/badge.svg?token=PHYGI9FI22" alt="Codecov Status">
  </a>
  <a href="https://www.codacy.com/gh/Riverside-Healthcare/RelativeToNow/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=Riverside-Healthcare/RelativeToNow&amp;utm_campaign=Badge_Grade">
    <img src="https://app.codacy.com/project/badge/Grade/2533c8838ffe4c6a82c889d6d98f2050" alt="Codacy Status">
  </a>
  <a href="https://pypi.org/project/relative-to-now/">
    <img src="https://badgen.net/pypi/v/relative-to-now" alt="Pypi Download">
  </a>
  <a href="https://pepy.tech/project/relative-to-now">
    <img src="https://static.pepy.tech/badge/relative-to-now" alt="Downloads">
  </a>
</p>


## 💾 Install

```sh
python -m pip install relative-to-now

# or

poetry add relative-to-now
```

## ✨ How to Use

Possible input types:

  * time.time()
  * datetime.date.today()
  * datetime.datetime.now()

Optional inputs:

  * ``no_errors`` (Defaults to ``False``, set to ``True`` to return value when there is an error instead of raising)

Output:
    <int> <unit> <text>

Examples:
```python
import datetime
from RelativeToNow import relative_to_now

print(relative_to_now(datetime.datetime.now() + datetime.timedelta(days=1)))
>>> 1 day from now
```

Precision for `datetime.date` is days.
```python
import datetime
from RelativeToNow import relative_to_now

print(relative_to_now(datetime.date.today() - datetime.timedelta(days=2)))
>>> 2 days ago
```

```python
import time
from RelativeToNow import relative_to_now

print(relative_to_now(time.time()))
>>> just now
```

