Common datetime operations missing from the standard library.
Project description
philiprehberger-datetime-kit
Common datetime operations missing from the standard library.
Installation
pip install philiprehberger-datetime-kit
Usage
from philiprehberger_datetime_kit import business_days, date_range, relative
# Count business days between two dates
count = business_days("2026-03-16", "2026-03-20") # 4
Business Days with Holidays
from philiprehberger_datetime_kit import business_days
count = business_days("2026-03-16", "2026-03-20", holidays=["2026-03-18"]) # 3
Date Range
from philiprehberger_datetime_kit import date_range
for d in date_range("2026-03-01", "2026-03-05"):
print(d)
Relative Time
from philiprehberger_datetime_kit import relative
tomorrow = relative(days=1)
one_hour_ago = relative(hours=-1)
Start and End of Period
from philiprehberger_datetime_kit import start_of, end_of
start = start_of("month") # first moment of current month
end = end_of("day") # last moment of today
API
| Function | Description |
|---|---|
business_days(start, end, holidays?) |
Count business days (Mon-Fri) between two dates |
date_range(start, end, step?) |
Yield dates from start to end inclusive |
relative(days?, hours?, minutes?, seconds?) |
Return UTC now offset by the given delta |
start_of(unit, dt?) |
Start of day/week/month/year |
end_of(unit, dt?) |
End of day/week/month/year |
Development
pip install -e .
python -m pytest tests/ -v
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
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 philiprehberger_datetime_kit-0.1.0-py3-none-any.whl.
File metadata
- Download URL: philiprehberger_datetime_kit-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d509f16b59d0a62ac7c695bdf4b0a2e730bbccd8f8154a103aa3320bcccb63ab
|
|
| MD5 |
af242d5e1c561eb794980f127125dbcf
|
|
| BLAKE2b-256 |
f10405d17dd6d37ed30dcd6e6553bced1f79ee3e31fcf94a67832b7893a61333
|