Skip to main content

holiday is a package to generate holiday.

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

holiday-1.0.0.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

holiday-1.0.0-py2.py3-none-any.whl (6.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file holiday-1.0.0.tar.gz.

File metadata

  • Download URL: holiday-1.0.0.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for holiday-1.0.0.tar.gz
Algorithm Hash digest
SHA256 7a0dd8fd59afb134f333b14a0c6b7ed4dc1b854f96b251ff8c1a635374ae2d0d
MD5 18793a352f08a9fedaaf748b8ed4f459
BLAKE2b-256 b8305f9fbd2f5c33025ec754229ee551fe6a9618dc31af3f0e71d9e170f3f653

See more details on using hashes here.

File details

Details for the file holiday-1.0.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for holiday-1.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 55341f7355d5bfd1e4d1086e060cd07d64192656fe9418a9903d9db5e5f4a08d
MD5 b48b93e33a3a1c970f81a7be63be71bb
BLAKE2b-256 d25231265e410ee09cd17890891ca2c60e7eadd1e793ef4c17ff820588eac4c4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page