Readable Timedelta (mark2)
Installation
pip install readabledelta2
Usage examples
from_timedelta creates a more human-friendly printable version of timedelta.
>>> delta = timedelta(weeks=53, hours=1, minutes=1)
>>> f"Update was {delta} ago"
'Update was 371 days, 1:01:00 ago'
>>> f"Update was {from_timedelta(delta)} ago"
'Update was 1 year, 6 days, 1 hour and 1 minute ago'
For negative timedeltas, the default representation is more machine-friendly than human-friendly: "an hour and five minutes" is easier for people to understand than the weird but technically-correct "negative one day plus 22 hours and 55 minutes"
>>> lunchtime = datetime(year=2015, month=5, day=27, hour=12)
>>> right_now = datetime(year=2015, month=5, day=27, hour=13, minute=5)
>>> f"{lunchtime - right_now}"
'-1 day, 22:55:00'
>>> f"{from_timedelta(lunchtime - right_now)}"
'-1 hour and 5 minutes'
Contributing
You want to contribute? Great! Here are the things you should do before submitting your PR:
- Fork the repo and git clone your fork.
devinstall the project package:pip install -e .[dev]- Optional (poetry users):
poetry install --extras dev
- Run
toxto perform tests frequently. - Create pull-request from your branch.
That's it! :)
Metadata
Release files for readabledelta2 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| readabledelta2-0.0.2.tar.gz | 9.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| readabledelta2-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.0 kB
Release files / readabledelta2-0.0.2.tar.gz
| Download URL | readabledelta2-0.0.2.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3d28949d0b85acbcbd2805b3037b11c10eaeb0a9db60cf9a1058a8e27c374ebe
|
|
BLAKE2b-256 checksum How to use checksums |
5c2e6831d2c097dfdeeb5c95c6b5d92bc45a13ec215c608e3a1199bdc837c219
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.0.0 CPython/3.12.4
|
Release files / readabledelta2-0.0.2-py3-none-any.whl
| Download URL | readabledelta2-0.0.2-py3-none-any.whl |
|---|---|
| Size | 7.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e2f762b4a41484a24723930976973bb37706c26f17686d974183241d4140250d
|
|
BLAKE2b-256 checksum How to use checksums |
bb4271752b4db192b8a6ae2db472e5757f4f4983dc2d6e174559e8b822823925
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.0.0 CPython/3.12.4
|