Use fcalendar to identify time expressions in text and query Chinese public holiday schedules.
All commands output single-line JSON to stdout; errors go to stderr.
[!IMPORTANT] Always invoke fcalendar as
python3 -m fcalendar ...— this bypasses all PATH issues and works regardless of virtual environments, system Python, or installation prefix. Never rely on the barefcalendarcommand being on PATH.
Check if already installed (do this first — skip install if it succeeds): bash
python3 -c "import fcalendar; print('fcalendar installed, version:', fcalendar.__version__)"
If this prints a version number, skip to step 3.
Install (only if step 1 failed):
[!NOTE] Package Source: The
fcalendarpackage is available on PyPI at https://pypi.org/project/fcalendar/Source Code: You can review the source code at https://github.com/youngfreefjs/fcalendar
Security: This package only performs local date/time parsing and does not access network resources or collect user data.
bash
python3 -m pip install fcalendar
For enhanced security, consider installing in a virtual environment: bash
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
python3 -m pip install fcalendar
Verify: bash
python3 -m fcalendar --help
Confirm help output is shown. If this fails but step 1 succeeded, the package is installed but
may not support -m invocation — fall back to the full binary path:
bash
$(python3 -c "import sys, os; print(os.path.join(sys.prefix, 'bin', 'fcalendar'))") --help
Get current date when needed: date +%Y-%m-%d
[!NOTE] Invocation rule: In all commands below, replace
fcalendarwithpython3 -m fcalendar. Example:fcalendar query "明天"→python3 -m fcalendar query "明天"
query#Identifies and annotates time expressions in natural language, resolving them to exact dates.
Command:
text
fcalendar query "<text>" [--today YYYY-MM-DD] [--lang zh|en]
Arguments:
ArgumentRequiredDescription<text>yesNatural language text containing time expressions--todaynoReference date (YYYY-MM-DD). Defaults to system date--langnoLanguage: zh or en. Defaults to auto-detect
Output:
json
{"input": "下周开会", "result": "下周开会(今天是2026年3月31日,下周是2026年4月6日至12日)"}
Examples:
bash
fcalendar query "明天下午三点开会"
fcalendar query "国庆节去旅游" --today 2026-09-01
fcalendar query "meeting next Monday" --lang en
fcalendar query "春节回家" --today 2026-01-15
Supported time expression types:
For a comprehensive list of all supported time expression types with detailed examples, see references/time-expressions.md.
Key categories include:
holiday#Queries public holidays and normal weekends within a specified time range. Excludes workdays-on-weekends (调休上班) to avoid confusion.
For detailed information about Chinese public holidays and solar terms, see references/holidays.md.
Command:
text
fcalendar holiday [--scope <scope>] [--today YYYY-MM-DD]
Arguments:
ArgumentRequiredDefaultDescription--scopenohalf_yearTime range (see below)--todaynosystem dateReference date (YYYY-MM-DD)
Supported scope values (Chinese and English both accepted):
ScopeAliasDescriptionhalf_year``半年, 未来半年Next 180 days (default)this_week``本周, 这周Mon–Sun of current weeknext_week``下周, 下一周Mon–Sun of next weeknext_month``下个月, 下一个月, 下月Full next calendar monthweeks=N``N周, 未来N周Next N weeks from todaymonths=N``N个月, 未来N个月Next N months from today
N supports Chinese numerals: 一、两、三、四...十二, and Arabic numerals.
Output: JSON array, sorted by start date ascending.
json
[
{"type": "holiday", "name": "劳动节", "start": "2026-05-01", "end": "2026-05-05", "days": 5},
{"type": "weekend", "name": "周末", "start": "2026-05-09", "end": "2026-05-10", "days": 2}
]
Output fields:
FieldTypeDescriptiontypestring"holiday" = Chinese public holiday; "weekend" = normal restful weekendnamestringHoliday name (e.g. "春节", "周末")startstringStart date, ISO format (YYYY-MM-DD)endstringEnd date, ISO format (YYYY-MM-DD)daysintNumber of days
Note: Workdays-on-weekends (调休上班) are NOT included in the output. The list only shows days off.
Examples:
bash
fcalendar holiday # next 180 days (default)
fcalendar holiday --scope this_week # this week
fcalendar holiday --scope 本周 # same as above (Chinese)
fcalendar holiday --scope next_week # next week
fcalendar holiday --scope next_month # next full month
fcalendar holiday --scope weeks=3 # next 3 weeks
fcalendar holiday --scope 三周 # same as weeks=3 (Chinese numeral)
fcalendar holiday --scope months=2 # next 2 months
fcalendar holiday --scope 未来两个月 # same as months=2
fcalendar holiday --scope half_year --today 2026-09-01 # 180 days from Sep 1
[!IMPORTANT] Strict Output Rule: Always use the exact content returned by the
fcalendarCLI. Do NOT paraphrase, rewrite, supplement, or infer beyond what the CLI returns. Theresultfield (forquery) and the JSON array (forholiday) are the single source of truth. Present them as-is after formatting; never modify their semantic content.
General principle: output must be valid Markdown with clear structure.
For query: display the result field directly as the annotated response. Do not display raw JSON to the user.
For holiday:
type: list holiday entries first, then weekend entries.holiday#text
## 放假安排([scope描述])
### 法定节假日
| 假期 | 开始 | 结束 | 天数 |
|------|------|------|------|
| 劳动节 | 2026-05-01 | 2026-05-05 | 5天 |
### 普通周末
| 日期 | 天数 |
|------|------|
| 2026-04-25 ~ 2026-04-26 | 2天 |
--scope value is invalid, the CLI exits with a non-zero code and prints an error to stderr. Inform the user of valid scope formats.date +%Y-%m-%d before calling if real-time accuracy is required.