Skip to main content

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() and end_of_week() with customizable week start (Sunday or Monday)
  • yesterday() and tomorrow() with optional reference date
  • ✅ Works with date objects 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

timecraftx-0.5.1.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

timecraftx-0.5.1-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file timecraftx-0.5.1.tar.gz.

File metadata

  • Download URL: timecraftx-0.5.1.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.3

File hashes

Hashes for timecraftx-0.5.1.tar.gz
Algorithm Hash digest
SHA256 39fa44b9ab079145d57048ab2db3a43c3ea0c01cfbc6e3b1a64075d9d43d052c
MD5 6f76d858f8d3a1a36d22836a282fec23
BLAKE2b-256 852275fe238be0d0aac38429a4e70db40d5b224acf5506f99a197d775756b014

See more details on using hashes here.

File details

Details for the file timecraftx-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: timecraftx-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.3

File hashes

Hashes for timecraftx-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 eda13e75c7c281d4422bf1156bb2bd769af59401009e94e2565255f3c0cf98c4
MD5 6796beed617385ef41aba755a81787dc
BLAKE2b-256 24d2cea4b66384c54d954a7ed47977f64efd32ecd4b44e488c33ce25c3add66f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page