⏳ Timecraftx
Lightweight, readable, and powerful date utilities for Python.
Get common date calculations like start_of_week, end_of_week, yesterday, tomorrow, or even next_friday and prev_monday — with beautiful, clean code.
🔧 Features
- ✅
start_of_week()andend_of_week()with customizable week start (Sunday or Monday) - ✅
yesterday()andtomorrow()with optional reference date - ✅
next_weekday()andprev_weekday()with helpers likenext_monday(),prev_sunday(), etc. - ✅ Works with
dateobjects directly (no timezone mess) - ✅ Enum-based safety for weekdays via
Day - ✅ Fully tested, no external dependencies
📦 Installation
pip install timecraftx
🚀 Quickstart
from datetime import date
from timecraftx import (
start_of_week, end_of_week, yesterday, tomorrow,
next_friday, prev_monday, Day
)
today = date(2025, 6, 4)
print(start_of_week(today)) # 2025-06-02 (Monday)
print(end_of_week(today)) # 2025-06-08 (Sunday if Monday is week start)
print(yesterday(today)) # 2025-06-03
print(tomorrow(today)) # 2025-06-05
print(next_friday(today)) # 2025-06-06
print(prev_monday(today)) # 2025-06-02
📘 API Reference
Week Utilities
start_of_week(from_date: Optional[date] = None, week_start: Day = Day.MONDAY) -> date
Returns the first day of the week. Defaults to today and Monday.
end_of_week(from_date: Optional[date] = None, week_start: Day = Day.MONDAY) -> date
Returns the last day of the week (6 days after start_of_week).
Relative Days
yesterday(from_date: Optional[date] = None) -> date
Returns the day before the given date.
tomorrow(from_date: Optional[date] = None) -> date
Returns the day after the given date.
Next Weekday Utilities
next_weekday(from_date: Optional[date] = None, target: Day = Day.MONDAY) -> date
Returns the next occurrence of a specific weekday.
Day-specific helpers:
next_monday()next_tuesday()next_wednesday()next_thursday()next_friday()next_saturday()next_sunday()
Previous Weekday Utilities
prev_weekday(from_date: Optional[date] = None, target: Day = Day.MONDAY) -> date
Returns the most recent past occurrence of a specific weekday.
Day-specific helpers:
prev_monday()prev_tuesday()prev_wednesday()prev_thursday()prev_friday()prev_saturday()prev_sunday()
Enum
Day
Enum values for each day of the week, from Day.MONDAY to Day.SUNDAY.
🛡️ License
MIT License. See LICENSE.
👤 Author
Jacobo Tapia
GitHub: @Jatapiaro
Project: https://github.com/Jatapiaro/timecraftx
🌟 Contribute
Found a bug or have an idea? PRs welcome. Open an issue or submit a patch.
Metadata
Release files for timecraftx 1.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 | Provenance | Actions |
|---|---|---|---|---|
| timecraftx-1.0.2.tar.gz | 10.7 kB | Without provenance | Details for timecraftx-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| timecraftx-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for timecraftx-1.0.2-py3-none-any.whl |
Total release size: 17.3 kB
Release files / timecraftx-1.0.2.tar.gz
| Download URL | timecraftx-1.0.2.tar.gz |
|---|---|
| Size | 10.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
62f2dc3a8c5a033b09432c8f50b6e7da9812ee3c62d8d18b4424b237ded11dca
|
|
BLAKE2b-256 checksum How to use checksums |
5c61ff5373d2385801c89e62b7910210ef7fb81c5786dd679ec6e41ffad6448e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.32.3
|
Release files / timecraftx-1.0.2-py3-none-any.whl
| Download URL | timecraftx-1.0.2-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
84dbdd0f9cdb5b2c558bf242380e2b80293da07dad939f516751e6fbd3a082bb
|
|
BLAKE2b-256 checksum How to use checksums |
fc7c08127f7cd407eef5def586828ea4dc9f5cf1b6ad6f133983fe4daab07772
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.32.3
|
Security for timecraftx 1.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.