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.29.tar.gz
(5.7 kB
view hashes)
Built Distribution
Close
Hashes for calendarutil-2021.3.29-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3cc0df6a7a0e6d308be78c062fc5d7d263eb2f407a465292f1ce2fd14d49f24c |
|
MD5 | 18eaeae118c1e6aaf5b204ec4314f8e7 |
|
BLAKE2b-256 | 79b5956025cbeec63a9c6431d5409f39f6e0c1c6402881f29a65aace21bc7629 |