mirror of
https://github.com/SeCherkasov/util-linux-cal.git
synced 2026-03-30 16:01:50 +03:00
Bug fixes: - Fix Zeller's formula for Julian calendar (separate branch without century correction) and use rem_euclid for negative modulo safety - Pass country code (cc=) to isdayoff.ru API in holiday plugin - Sync clap --version with Cargo.toml (was hardcoded "1.0.0") Tests: - Rename integration_tests.rs to unit_tests.rs (they are unit tests) - Fix race condition on env vars in plugin tests (Mutex + remove_var) - Fix incorrect assertions (color tty detection, locale fallback) - Add missing test cases: Julian/Gregorian Zeller, display date parsing, Sunday offset, week numbers, edge cases (87 tests total) - Remove brittle version-checking tests
Holiday Highlighter Plugin
Plugin for cal that adds holiday highlighting via isdayoff.ru API.
Features
- Automatic country detection from system locale
- Data caching to reduce API requests
- Multiple country support: Russia, Belarus, Kazakhstan, USA, Uzbekistan, Turkey, Latvia
- Day type data: working days, weekends, shortened days, official holidays
Building
# Build entire workspace
cargo build --release --workspace
# Plugin only
cargo build --release -p holiday_highlighter
Installation
User-local
mkdir -p ~/.local/lib/cal/plugins
cp target/release/libholiday_highlighter.so ~/.local/lib/cal/plugins/
System-wide
sudo mkdir -p /usr/lib/cal/plugins
sudo cp target/release/libholiday_highlighter.so /usr/lib/cal/plugins/
Usage
# Highlight holidays for current country
cal -H
# Year with holidays
cal -y -H
# Three months with holidays
cal -3 -H
Supported countries
| Code | Country | Auto-detect locales |
|---|---|---|
| RU | Russia | ru_RU, ru_BY, ru_KZ, ru_UZ, ru_LV |
| BY | Belarus | be_BY, ru_BY |
| KZ | Kazakhstan | kk_KZ, ru_KZ |
| US | USA | en_US, en |
| UZ | Uzbekistan | uz_UZ, ru_UZ |
| TR | Turkey | tr_TR |
| LV | Latvia | lv_LV, ru_LV |
API
The plugin uses isdayoff.ru API:
Monthly request
GET https://isdayoff.ru/api/getdata?year=2026&month=01&pre=1
Yearly request
GET https://isdayoff.ru/api/getdata?year=2026&pre=1
Parameter pre=1 includes pre-holiday shortened days information.
Data format
Each character in the response represents a day of the month:
| Character | Day type | Description |
|---|---|---|
0 |
Working | Regular working day |
1 |
Weekend | Saturday or Sunday |
2 |
Shortened | Pre-holiday shortened day |
8 |
Holiday | Official public holiday |
Environment variables
| Variable | Description |
|---|---|
LC_ALL |
Priority locale for country detection |
LC_TIME |
Locale for country detection |
LANG |
Fallback locale for country detection |