No project description provided
Project description
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! :)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file readabledelta2-0.0.2.tar.gz.
File metadata
- Download URL: readabledelta2-0.0.2.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d28949d0b85acbcbd2805b3037b11c10eaeb0a9db60cf9a1058a8e27c374ebe
|
|
| MD5 |
d03a7c40bf4c27000a4288883385d1a9
|
|
| BLAKE2b-256 |
5c2e6831d2c097dfdeeb5c95c6b5d92bc45a13ec215c608e3a1199bdc837c219
|
File details
Details for the file readabledelta2-0.0.2-py3-none-any.whl.
File metadata
- Download URL: readabledelta2-0.0.2-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2f762b4a41484a24723930976973bb37706c26f17686d974183241d4140250d
|
|
| MD5 |
9a2a1d91426c64370e42f2e121ae798f
|
|
| BLAKE2b-256 |
bb4271752b4db192b8a6ae2db472e5757f4f4983dc2d6e174559e8b822823925
|