Skip to main content

isdayoff

Production Calendar API

Description:

  • Checking the date for belonging to a non-working day, according to official decrees and orders.

Official API website - https://isdayoff.ru

install

pip install isdayoff

Checking tomorrow

import asyncio

from isdayoff import DateType, ProdCalendar

calendar = ProdCalendar(locale='us')


async def main():
    if await calendar.tomorrow() == DateType.WORKING:
        print('Tomorrow is a working day')
    else:
        print('Tomorrow is a day off')
    
    
loop = asyncio.get_event_loop()
loop.create_task(main())
loop.run_forever()

Checking today

params

  • locale: str - country code (by, kz, ru, ua)

  • pre: bool - mark shortened working days

  • covid: bool - mark working days (due to the COVID-19 pandemic)

  • sd: bool - consider that the week is six days long

await calendar.today(locale='ru', pre=True, covid=True, sd=True)

Weekend on this date

params

  • date: datetime.date - date

  • locale: str - country code (by, kz, ru, ua)

  • pre: bool - mark shortened working days

  • covid: bool - mark working days (due to the COVID-19 pandemic)

  • sd: bool - consider that the week is six days long

import asyncio
from datetime import date

from isdayoff import DateType, ProdCalendar

calendar = ProdCalendar(locale='us')


async def main():
    if await calendar.date(date(2021, 8, 25)) == DateType.WORKING:
        print('Is a working day')
    else:
        print('Is a day off')
...

Getting information about days for a month

  • date: datetime.date - date

  • locale: str - country code (by, kz, ru, ua)

  • pre: bool - mark shortened working days

  • covid: bool - mark working days (due to the COVID-19 pandemic)

  • sd: bool - consider that the week is six days long

await calendar.month(date(2021, 8, 1))

Getting information about days for the year

  • date: datetime.date - date

  • locale: str - country code (by, kz, ru, ua)

  • pre: bool - mark shortened working days

  • covid: bool - mark working days (due to the COVID-19 pandemic)

  • sd: bool - consider that the week is six days long

await calendar.year(date(2021, 1, 1))

Getting information about days for a derived period

  • start_date: datetime.date - date

  • end_date: datetime.date - date

  • locale: str - country code (by, kz, ru, ua)

  • pre: bool - mark shortened working days

  • covid: bool - mark working days (due to the COVID-19 pandemic)

  • sd: bool - consider that the week is six days long

await calendar.range_date(date(2021, 1, 1), date(2021, 5, 1))

Is it a leap year

  • date: datetime.date - date
await calendar.is_leap(date(2021, 1, 1))

Example

from isdayoff import ProdCalendar, DateType
from datetime import date
import asyncio


calendar = ProdCalendar(locale='us')


async def main():
    res = await calendar.month(date(2021, 8, 1), locale='ru')
    count = len([DateType.NOT_WORKING for day in res if res[day] == DateType.NOT_WORKING])
    print('Days off in a month', count)

loop = asyncio.get_event_loop()
loop.create_task(main())
loop.run_forever()

Release files for isdayoff 1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for isdayoff 1.0
File Size Uploaded
isdayoff-1.0.tar.gz 4.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for isdayoff 1.0
File Interpreter ABI Platform
isdayoff-1.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.1 kB

Release files / isdayoff-1.0.tar.gz

Download URL isdayoff-1.0.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
93a555a81e0f9a8bd5c29377aaed5a581a1fe5c9d2269994f4afbc6ee9162b61
BLAKE2b-256 checksum
How to use checksums
4536d581e2611e8b867953e8a59e76e47c01f87a6a14859a6c39839c19ee45e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.6.8

Release files / isdayoff-1.0-py3-none-any.whl

Download URL isdayoff-1.0-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
165e53b75fb028c20f3af4df9a0ec39983cb425469a0919c1922233401413766
BLAKE2b-256 checksum
How to use checksums
da1ae837389574d698add7be110ec54f6a90c083919959f5c520000e4a031619
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.6.8

Release history Release notifications | RSS feed

This release

1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page