Determines if a day is a working day in Russia
Project description
Work Calendar
A simple no-nonsense library to find out whether a day is a working day in Russia.
Data obtained from consultant.org. I try to parse it as soon as the official calendar for the following year is published, which is normally late summer or early autumn.
Data available for years 2015-2025. Feel free to use the raw json file.
Installation
pip install work-calendar
Usage
from datetime import date
import work_calendar
new_years_holiday = date(2020, 1, 2)
weekend = date(2021, 4, 4)
workday = date(2020, 6, 3)
for day in [new_years_holiday, weekend, workday]:
if work_calendar.is_workday(day):
print(f"{day.strftime('%A %d.%m.%Y')} is a workday in Russia")
else:
print(f"{day.strftime('%A %d.%m.%Y')} is not a workday in Russia")
dt_out_of_bounds = dt = date(2090, 1, 2)
try:
work_calendar.is_workday(dt_out_of_bounds)
except work_calendar.NoDataForYearError:
print(f"No data found for date {dt_out_of_bounds} in work calendar!")
Output
Thursday 02.01.2020 is not a workday in Russia
Sunday 04.04.2021 is not a workday in Russia
Wednesday 03.06.2020 is a workday in Russia
No data found for date 2090-01-02 in work calendar!
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
work_calendar-1.0.0.tar.gz
(9.6 kB
view details)
Built Distribution
File details
Details for the file work_calendar-1.0.0.tar.gz
.
File metadata
- Download URL: work_calendar-1.0.0.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.12.3 Darwin/23.0.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ba55ae673c7729ae76be62120d7318acea5e2bea16c61956fbe43a9143f7299 |
|
MD5 | dab43fe4ae92813cd9b2c48e1b0e4be2 |
|
BLAKE2b-256 | 7e88762782fea6bf2b50330348b9dff7bd4f35f9eb936abcfdfd881031952a0c |
File details
Details for the file work_calendar-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: work_calendar-1.0.0-py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.12.3 Darwin/23.0.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 086fc676161dcce2d4c9ca8b816867df54b5ece40601f9e475546611be2fd9dc |
|
MD5 | fe94186d17254c5fb4dfdca238b71c97 |
|
BLAKE2b-256 | 97a252adf6150e13e2b94a9aca52f0ffa97e59e75d18e0b60d62e796d2ce1e6e |