Business days in Poland
Project description
plbdays
plbdays
is a Python library designed to determine business days in Poland. This library provides functions to check if a date is a business day, find the last or next business day, and generate a list of business days between two dates. It is useful for handling date calculations in business applications that adhere to Polish holidays and weekends.
Features
- Check if a date is a business day
- Find the most recent business day before or on a given date
- Find the next business day after or on a given date
- Generate a list of business days between two dates
Installation
pip install plbdays
or
git clone https://github.com/yourusername/plbdays.git
Usage
isBusinessDay(date='today')
Checks if a given date is a business day in Poland.
- Parameters:
date
(str, optional): The date to check in 'YYYY-MM-DD' format or as a datetime object. Defaults to 'today'.
- Returns:
bool
: True if the date is a business day, False otherwise.
Example:
from plbdays import isBusinessDay
print(isBusinessDay('2024-07-23')) # Output: True or False
lastBD(date='today')
Finds the most recent business day before or on the given date.
- Parameters:
date
(str, optional): The date to check in 'YYYY-MM-DD' format or as a datetime object. Defaults to 'today'.
- Returns:
str
: The most recent business day in 'YYYY-MM-DD' format.
Example:
from plbdays import lastBD
# Find the last business day before or on a specific date
print(lastBD('2024-07-24')) # Output: '2024-07-23'
# Find the last business day before or on today
print(lastBD()) # Output: 'YYYY-MM-DD' of the most recent business day
nextBD(date='today')
Finds the next business day after or on the given date.
- Parameters:
date
(str, optional): The date to start from in 'YYYY-MM-DD' format or as a datetime object. Defaults to 'today'.
- Returns:
str
: The next business day in 'YYYY-MM-DD' format.
Example:
from plbdays import lastBD
# Find the next business day after or on a specific date
print(nextBD('2024-07-24')) # Output: '2024-07-25'
# Find the next business day after or on today
print(nextBD()) # Output: 'YYYY-MM-DD' of the next business day
BDays_list(start_date, end_date)
Generates a list of business days between two dates.
-
Parameters:
start_date
(str, optional): The start date in 'YYYY-MM-DD' format.end_date
(str, optional): The end date in 'YYYY-MM-DD' format.
-
Returns:
list of lists
: Each sublist contains a date in 'YYYY-MM-DD' format and a boolean indicating if it's a business day.
Example:
from plbdays import BDays_list
# Generate a list of business days between two dates
print(BDays_list('2024-07-20', '2024-07-25'))
# Output: [['2024-07-20', False], ['2024-07-21', False], ['2024-07-22', True], ['2024-07-23', True], ['2024-07-24', True], ['2024-07-25', True]]
Usage
- Python 3.x
License
This project is licensed under the MIT License.
Change Log
1.1.1 (25/07/2024)
-Add nextBD() function -Fixed bug
0.0.1 (27/11/2021)
-First Release
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
Built Distribution
File details
Details for the file plbdays-1.1.1.tar.gz
.
File metadata
- Download URL: plbdays-1.1.1.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e2f4e5abc2e4bd374702731310a395334400816c9e8dea4b0cb901e14a38a31 |
|
MD5 | c8e3c8973a2b24880adf4dfc6967c9e8 |
|
BLAKE2b-256 | a9bbfe74cbcf3738431c78ecf4bfbc105e377593e8c26a9d39ed8af16113d85d |
File details
Details for the file plbdays-1.1.1-py3-none-any.whl
.
File metadata
- Download URL: plbdays-1.1.1-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c003bb150ced9937f20e3db07b724a6c9cdd3e6d04c4de2230e993f75d1fa05 |
|
MD5 | cfb3796bc204664f6592ab2f49241033 |
|
BLAKE2b-256 | 4059193938ab6d524745fa2810e071a72292aeb4f9226f42dc416666481251a2 |