Simple and lightweight calendar support for python datetime.date
Project description
calendar-util
Simple calendar support for python datetime.date
Setup
- Install via pip (
pip install calendarutil
) - or via git (
git clone "https://github.com/github-suraj/calendar-util"
)
Usage
1. Get first Monday of month
>>> from calendarutil.util import first
>>> first.first_monday_of_month(2021, 4)
datetime.date(2021, 4, 5)
2. Get list of first Monday of month for a year
>>> from calendarutil.from_year import first
>>> first.first_monday_of_month(2021)
[datetime.date(2021, 1, 4), datetime.date(2021, 2, 1), datetime.date(2021, 3, 1), datetime.date(2021, 4, 5), datetime.date(2021, 5, 3), datetime.date(2021, 6, 7), datetime.date(2021, 7, 5), datetime.date(2021, 8, 2), datetime.date(2021, 9, 6), datetime.date(2021, 10, 4), datetime.date(2021,
11, 1), datetime.date(2021, 12, 6)]
3. Get list of first Monday of month for a date range
>>> from datetime import date
>>> from calendarutil.from_range import first
>>> dt1 = date(2021, 3, 1)
>>> dt2 = date(2021, 9, 1)
>>> first.first_monday_of_month(dt1, dt2)
[datetime.date(2021, 3, 1), datetime.date(2021, 4, 5), datetime.date(2021, 5, 3), datetime.date(2021, 6, 7), datetime.date(2021, 7, 5), datetime.date(2021, 8, 2), datetime.date(2021, 9, 6)]
Supported frequency
- first
- second
- third
- fourth
- last
Supported weekday
- monday
- tuesday
- wednesday
- thursday
- friday
- saturday
- sunday
Show your Support
Give us a :star2: if this project helped you!
License
Copyright © 2021 Suraj Jaiswal
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
calendarutil-2021.3.28.tar.gz
(5.0 kB
view hashes)
Built Distribution
Close
Hashes for calendarutil-2021.3.28-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99179f475ab97fae6df488dd8ba2bf5a5b945cd674b7e732ccd48fc1e734a188 |
|
MD5 | 8d03b444d8cfc1f41c807cc3b3147c1c |
|
BLAKE2b-256 | 3b17f78d1a234b356d4e8ec75bdb4ba6fe3df0608a85369f1c07f8aa52b19773 |