Judgment whether the holiday
Requiremants
Python 2.7 or later.
Install
$ pip install holiday
holiday format
('*', '*', '*', '*', '*')
┬ ┬ ┬ ┬ ┬
│ │ │ │ │
│ │ │ │ │
│ │ │ │ └─ number of week (1 - 5)
│ │ │ └─── day of week (1 to 7 or mon to sun)
│ │ └───── day of month (1 - 31)
│ └─────── month (1 - 12)
└───────── year (1 - 9999)
'*' The asterisk allows all
Usage
>>> holiday = Holiday([
... (2016, 1, 1, 'fri', 1),
... (2016, 1, 2, 'sat', 1),
... ])
>>> holiday.is_holiday(date(2016, 1, 1)) # 2016-1-1 Friday 1
True
>>> holiday.is_holiday(date(2016, 1, 3)) # 2016-1-3 Sunday 1
False
Express all values that can take in the field in asterisk (*)
>>> holiday = Holiday([
... ('*', 1, 1, 'fri', 1),
... ('*', 1, 1, 'thu', 1),
... ])
>>> holiday.is_holiday(date(2016, 1, 1)) # 2016-1-1 Friday 1
True
>>> holiday.is_holiday(date(2015, 1, 1)) # 2015-1-1 Thursday 1
True
>>> holiday.is_holiday(date(2014, 1, 1)) # 2014-1-1 Wednesday 1
False
is_business_day() returns the inverse of the truth-value of the is_holiday()
>>> holiday = Holiday([
... ('*', '*', '*', '*', '*'),
... ])
>>> holiday.is_holiday(date(2016, 1, 1)) # 2016-1-1 Friday 1
True
>>> holiday.is_business_day(date(2016, 1, 1)) # 2016-1-1 Friday 1
False
License
This software is released under the MIT License, see LICENSE.txt.
Release files for holiday 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| holiday-1.0.0.tar.gz | 5.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| holiday-1.0.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 11.4 kB
Release files / holiday-1.0.0.tar.gz
| Download URL | holiday-1.0.0.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7a0dd8fd59afb134f333b14a0c6b7ed4dc1b854f96b251ff8c1a635374ae2d0d
|
|
BLAKE2b-256 checksum How to use checksums |
b8305f9fbd2f5c33025ec754229ee551fe6a9618dc31af3f0e71d9e170f3f653
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / holiday-1.0.0-py2.py3-none-any.whl
| Download URL | holiday-1.0.0-py2.py3-none-any.whl |
|---|---|
| Size | 6.0 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
55341f7355d5bfd1e4d1086e060cd07d64192656fe9418a9903d9db5e5f4a08d
|
|
BLAKE2b-256 checksum How to use checksums |
d25231265e410ee09cd17890891ca2c60e7eadd1e793ef4c17ff820588eac4c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |