Python library to check whether a given date is a holiday or workday in China, based on the official government announcements. Current version 1.11.0, released 2025-03-10. Active development, ~2 releases per year.
pip install chinese-calendarNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Basic usage: check holidays, workdays, and get holiday names.
Always check the official Chinese government holiday announcement for the year. The library may lag behind the announcement.
Replace `isHoliday(date)` with `is_holiday(date)`.
Install chinese-calendar normally; pip should install lunardate automatically. If you see ImportError for lunardate, install it explicitly: `pip install lunardate`.
Use `get_holiday_detail` to distinguish between actual holidays (e.g., Spring Festival) and regular weekends. `is_workday` will be True only for days that are officially workdays (including compensation workdays on weekends).
Use `from chinese_calendar import is_holiday` instead.
Ensure you have the latest version: `pip install --upgrade chinese-calendar`. Then use `from chinese_calendar import get_holiday_detail`.
Convert your date string to a `date` object: `from datetime import datetime; my_date = datetime.strptime('2026-01-01', '%Y-%m-%d').date(); is_holiday(my_date)`.Ensure the date is within the supported range. If you need dates outside this range, consider another library or handle manually.
No dependency data recorded yet.