Lightweight utilities for working with dates and time in Python.
Project description
⏳ Timecraftx
Lightweight, readable, and powerful date utilities for Python.
Get common date calculations like start_of_week, end_of_week, yesterday, and tomorrow—with beautiful, clean code.
🔧 Features
- ✅
start_of_week()andend_of_week()with customizable week start (Sunday or Monday) - ✅
yesterday()andtomorrow()with optional reference date - ✅ Works with
dateobjects directly (no timezone mess) - ✅ Enum-based safety for weekdays
- ✅ 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, Day
today = date(2024, 5, 30)
print(start_of_week(today)) # Monday of the current week
print(start_of_week(today, week_start=Day.SUNDAY)) # Sunday of the current week
print(end_of_week(today)) # Saturday (if week starts Monday)
print(yesterday(today)) # 2024-05-29
print(tomorrow(today)) # 2024-05-31
📘 API Reference
start_of_week(from_date: Optional[date] = None, week_start: Day = Day.MONDAY) -> date
Returns the first day of the week for a given date. Defaults to today and Monday as the first day.
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).
tomorrow(from_date: Optional[date] = None) -> date
Returns the next day.
yesterday(from_date: Optional[date] = None) -> date
Returns the previous day.
🛡️ 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.
Project details
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 timecraftx-1.0.0.tar.gz.
File metadata
- Download URL: timecraftx-1.0.0.tar.gz
- Upload date:
- Size: 10.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1cf961cdaa62252d8628d8db35fc3e1675cc8ccc7e92446332fb7b9ed045e1eb
|
|
| MD5 |
c5e6a1750bfa7437dfd198cc8c42611f
|
|
| BLAKE2b-256 |
f2f21649ab7286d8cb0032b5c5ae13afb2ad2554d25fc5d8ffb590b3cffbbcdc
|
File details
Details for the file timecraftx-1.0.0-py3-none-any.whl.
File metadata
- Download URL: timecraftx-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce6132250b84d30080094d528391598910801c7419764a3fda6245076c1c3d90
|
|
| MD5 |
5b7c13c54210a4d1cfb47f3c456d71e9
|
|
| BLAKE2b-256 |
fe7666da015a850159c754dea4f4efaaa342b9deecb4be0c79c53721d6e66397
|