A standardized holiday dataset (in JSON format) providing public holidays and working day adjustments for different regions.
Check out the live examples or example code.
This repository serves as a centralized data source for:
The data is sourced from official holiday announcements of each region:
npm install holiday-calendar
All data is stored in JSON format for easy integration:
Located at /data/index.json, contains year ranges for all regions:
{
"regions": [
{
"name": "CN",
"startYear": 2002,
"endYear": 2026
},
{
"name": "JP",
"startYear": 2000,
"endYear": 2026
}
]
}
public_holiday: Official public holidaystransfer_workday: Transferred working day, usually a weekend that becomes a workday{
"year": 2026,
"region": "CN",
"dates": [
{
"date": "2026-01-01",
"name": "New Year's Day",
"name_cn": "元旦",
"name_en": "New Year's Day",
"type": "public_holiday"
},
{
"date": "2026-01-04",
"name": "New Year's Day Workday",
"name_cn": "元旦补班",
"name_en": "New Year's Day Workday",
"type": "transfer_workday"
}
]
}
// Import the package
const HolidayCalendar = require('holiday-calendar');
// Create an instance
const calendar = new HolidayCalendar();
// Get index information
calendar.getIndex().then(index => {
console.log('Supported regions:', index.regions);
});
// Get date info for a specific date
calendar.getDateInfo('CN', '2026-01-01').then(dateInfo => {
if (dateInfo) {
console.log(`${dateInfo.date} is ${dateInfo.name_en}`);
}
});
// Get all dates for a specific year
calendar.getDates('CN', 2026).then(dates => {
console.log('2026 Dates:', dates);
});
// Get dates with filters
calendar.getDates('CN', 2026, {
type: 'public_holiday', // Filter by type: 'public_holiday' or 'transfer_workday'
startDate: '2026-01-01', // Filter by start date
endDate: '2026-12-31' // Filter by end date
}).then(dates => {
console.log('Filtered dates:', dates);
});
// Check if date is a workday: includes 1) Mon-Fri except public holidays, 2) transfer working weekends
calendar.isWorkday('CN', '2026-01-01').then(isWorkday => {
console.log('Is workday:', isWorkday); // false (New Year's Day holiday)
});
// Check if date is a holiday: includes 1) public holidays, 2) weekends except transfer workdays
calendar.isHoliday('CN', '2026-01-04').then(isHoliday => {
console.log('Is holiday:', isHoliday); // false (New Year's Day workday)
});
Raw JSON files can be accessed via:
https://unpkg.com/holiday-calendar/data/CN/2026.json
https://gcore.jsdelivr.net/gh/cg-zhou/holiday-calendar@main/data/CN/2026.json
<!-- Development version -->
<script src="https://unpkg.com/holiday-calendar/src/index.js"></script>
<!-- Production version (minified) -->
<script src="https://unpkg.com/holiday-calendar/src/index.min.js"></script>
Important Note: For users in mainland China, considering the stability of CDN services, it is recommended to deploy the JSON data from the
datadirectory on your own server to ensure a more reliable access experience.
Holiday data in this project is sourced from official announcements, but please note:
Therefore, when using this data, please always cross-reference with the latest official announcements to ensure accuracy.