Skip to main content

A Python package for determining whether a given date is a workday or a holiday in Taiwan, based on the official administrative calendar.

Project description

taiwan-holidays

taiwan-holidays is a Python package designed to check whether a specific date is a workday or a holiday in Taiwan, based on the official work calendar provided by the Taiwan government.

coverage license

Features

  • Determine if a date is a workday or holiday.
  • Support for official Taiwan government work calendar rules, including special adjusted workdays and holidays.
  • Easy-to-use API for date checking.
  • Currently, only the official Taiwanese government calendar of public working days starting from the year 2019 (Republic of China year 108) onwards is supported.

Installation

You can install taiwan-holidays via pip:

pip install taiwan-holidays

Usage

Here's how you can use taiwan-holidays in your Python project.

Example

from taiwan_holidays.taiwan_calendar import TaiwanCalendar


calendar = TaiwanCalendar()
date = dateutil.parser.parse('2024-12-08')
print(calendar.is_holiday(date))
print(calendar.is_holiday('2024-12-08'))
print(calendar.is_holiday('20241208'))
print(calendar.is_holiday('2024/12/08'))

# Iterate workdays through a range of dates, including the start and end dates
calendar.iter_workdays('2024-12-01', '2024-12-31')

# Also you can iterate with reversed dates
calendar.iter_workdays('2024-12-31', '2024-12-01')

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgements

Special thanks to the Taiwan government for providing the official administrative calendar as the basis for this package.

Feel free to report any issues or suggest new features in the Issues section.

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

taiwan_holidays-0.4.0.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

taiwan_holidays-0.4.0-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

Details for the file taiwan_holidays-0.4.0.tar.gz.

File metadata

  • Download URL: taiwan_holidays-0.4.0.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.11

File hashes

Hashes for taiwan_holidays-0.4.0.tar.gz
Algorithm Hash digest
SHA256 a5412194ba2ef1114cad9bffbfe0b8ec8dee7b2c831a65059933ca38c4ca4709
MD5 f6018174a2894fbb2e1e3642dcc25130
BLAKE2b-256 09745a23664e6dd054c6ca9424f0e9501d4d5ada87cc93c2cf8f77572781312e

See more details on using hashes here.

File details

Details for the file taiwan_holidays-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for taiwan_holidays-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d20796a16461d36bfd6240b6edabeb687cbd7e71b1a1bca1030f320143832736
MD5 7a345cc2d20ee4578827d039aa02b910
BLAKE2b-256 da46b6d862bd2a3a68f9837d1daa7ade75963345cc26c113057a1c9b652b2b74

See more details on using hashes here.

Supported by

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