技能标识:chinese-workdays
Calculate legal working days in China according to official government holiday schedules. Uses State Council-published arrangements to exclude weekends, public holidays, and include makeup workdays. Supports date ranges, months, quarters, and full years with automatic holiday calendar management.
根据中国政府节假日安排计算两个日期之间的工作日数量。
calc = ChineseWorkdays()
workdays = calc.count_workdays(2026-01-01, 2026-12-31)
print(f2026年全年工作日: {workdays}天)
2026年3月有多少个工作日?
2026年第一季度有多少个工作日?
计算2026-02-10至2026-03-20之间的工作日
2026年有多少个工作日?
bash
节假日安排以YAML格式存储在data/目录中:
yaml
year: 2026
country: China
holidays:
- name: 元旦
start: 2026-01-01
end: 2026-01-03
days_off: [2026-01-01, 2026-01-02] #放假日期
makeup_workdays: [2025-12-28, 2026-01-04] # 调休上班
note: 官方通知原文
国务院通常在每年11月发布次年节假日安排。请相应更新YAML文件:
📅 工作日统计
📊 期间: 2026-01-01 至 2026-12-31
📏 总天数: 365
💼 法定工作日: 248 天
工作日占比: 68.0%
📋 期间包含的节假日:
• 元旦: 2026-01-01 ~ 2026-01-03
• 春节: 2026-02-15 ~ 2026-02-23
...
python
for each day in date_range:
if day in makeup_workdays:
count += 1
elif day in public_holidays:
skip
elif day is weekend:
skip
else:
count += 1
chinese-workdays/
├── SKILL.md # 本文件
├── init.py # 包入口
├── chinese_workdays.py # 核心计算引擎
├── workdays_cmd.py # 命令行工具
├── README.md # 用户文档(可选)
└── data/
├── 2026.yaml # 2026年节假日安排(官方)
└── 2027.yaml # 2027年节假日安排(模板)
MIT许可证 - 可自由使用和修改。
以下为平台配置的接入选项,并非逐项实测通过。能否安装取决于客户端支持、技能来源和运行环境:
帮我安装 SkillHub 和 chinese-workdays-1776058510 技能
设置 SkillHub 为我的优先技能安装源,然后帮我安装 chinese-workdays-1776058510 技能
skillhub install chinese-workdays-1776058510
文件大小: 28.26 KB | 发布时间: 2026-4-14 11:53