Files
worklenz/worklenz-backend/docs/HOLIDAY_SYSTEM.md
chamiakJ 5214368354 feat(holiday-system): implement comprehensive holiday management features
- Added holiday types and organization holidays management with CRUD operations.
- Introduced country holidays import functionality using the date-holidays npm package.
- Created database migrations for holiday types and organization holidays tables.
- Developed a holiday calendar component for visual representation and management of holidays.
- Enhanced API routes for holiday-related operations and integrated them into the admin center.
- Updated frontend localization for holiday management features.
- Implemented scripts for populating holidays in the database for 200+ countries.
2025-07-16 07:59:27 +05:30

7.9 KiB

๐ŸŒ Holiday Calendar System

The Worklenz Holiday Calendar System provides comprehensive holiday management for organizations operating globally.

๐Ÿ“‹ Features

  • 200+ Countries Supported - Comprehensive holiday data for countries worldwide
  • Multiple Holiday Types - Public, Company, Personal, and Religious holidays
  • Import Country Holidays - Bulk import official holidays from any supported country
  • Manual Holiday Management - Add, edit, and delete custom holidays
  • Recurring Holidays - Support for annual recurring holidays
  • Visual Calendar - Interactive calendar with color-coded holiday display
  • Dark/Light Mode - Full theme support

๐Ÿš€ Quick Start

1. Database Setup

Run the migration to create the holiday tables:

# Run the migration
psql -d your_database -f database/migrations/20250130000000-add-holiday-calendar.sql

2. Populate Country Holidays

Use the npm package to populate holidays for 200+ countries:

# Run the holiday population script
./scripts/run-holiday-population.sh

This will populate holidays for years 2020-2030 for all supported countries.

3. Access the Holiday Calendar

Navigate to Admin Center โ†’ Overview to access the holiday calendar.

๐ŸŒ Supported Countries

The system includes 200+ countries across all continents:

North America

  • United States ๐Ÿ‡บ๐Ÿ‡ธ
  • Canada ๐Ÿ‡จ๐Ÿ‡ฆ
  • Mexico ๐Ÿ‡ฒ๐Ÿ‡ฝ

Europe

  • United Kingdom ๐Ÿ‡ฌ๐Ÿ‡ง
  • Germany ๐Ÿ‡ฉ๐Ÿ‡ช
  • France ๐Ÿ‡ซ๐Ÿ‡ท
  • Italy ๐Ÿ‡ฎ๐Ÿ‡น
  • Spain ๐Ÿ‡ช๐Ÿ‡ธ
  • Netherlands ๐Ÿ‡ณ๐Ÿ‡ฑ
  • Belgium ๐Ÿ‡ง๐Ÿ‡ช
  • Switzerland ๐Ÿ‡จ๐Ÿ‡ญ
  • Austria ๐Ÿ‡ฆ๐Ÿ‡น
  • Sweden ๐Ÿ‡ธ๐Ÿ‡ช
  • Norway ๐Ÿ‡ณ๐Ÿ‡ด
  • Denmark ๐Ÿ‡ฉ๐Ÿ‡ฐ
  • Finland ๐Ÿ‡ซ๐Ÿ‡ฎ
  • Poland ๐Ÿ‡ต๐Ÿ‡ฑ
  • Czech Republic ๐Ÿ‡จ๐Ÿ‡ฟ
  • Hungary ๐Ÿ‡ญ๐Ÿ‡บ
  • Romania ๐Ÿ‡ท๐Ÿ‡ด
  • Bulgaria ๐Ÿ‡ง๐Ÿ‡ฌ
  • Croatia ๐Ÿ‡ญ๐Ÿ‡ท
  • Slovenia ๐Ÿ‡ธ๐Ÿ‡ฎ
  • Slovakia ๐Ÿ‡ธ๐Ÿ‡ฐ
  • Lithuania ๐Ÿ‡ฑ๐Ÿ‡น
  • Latvia ๐Ÿ‡ฑ๐Ÿ‡ป
  • Estonia ๐Ÿ‡ช๐Ÿ‡ช
  • Ireland ๐Ÿ‡ฎ๐Ÿ‡ช
  • Portugal ๐Ÿ‡ต๐Ÿ‡น
  • Greece ๐Ÿ‡ฌ๐Ÿ‡ท
  • Cyprus ๐Ÿ‡จ๐Ÿ‡พ
  • Malta ๐Ÿ‡ฒ๐Ÿ‡น
  • Luxembourg ๐Ÿ‡ฑ๐Ÿ‡บ
  • Iceland ๐Ÿ‡ฎ๐Ÿ‡ธ

Asia

  • China ๐Ÿ‡จ๐Ÿ‡ณ
  • Japan ๐Ÿ‡ฏ๐Ÿ‡ต
  • South Korea ๐Ÿ‡ฐ๐Ÿ‡ท
  • India ๐Ÿ‡ฎ๐Ÿ‡ณ
  • Pakistan ๐Ÿ‡ต๐Ÿ‡ฐ
  • Bangladesh ๐Ÿ‡ง๐Ÿ‡ฉ
  • Sri Lanka ๐Ÿ‡ฑ๐Ÿ‡ฐ
  • Nepal ๐Ÿ‡ณ๐Ÿ‡ต
  • Thailand ๐Ÿ‡น๐Ÿ‡ญ
  • Vietnam ๐Ÿ‡ป๐Ÿ‡ณ
  • Malaysia ๐Ÿ‡ฒ๐Ÿ‡พ
  • Singapore ๐Ÿ‡ธ๐Ÿ‡ฌ
  • Indonesia ๐Ÿ‡ฎ๐Ÿ‡ฉ
  • Philippines ๐Ÿ‡ต๐Ÿ‡ญ
  • Myanmar ๐Ÿ‡ฒ๐Ÿ‡ฒ
  • Cambodia ๐Ÿ‡ฐ๐Ÿ‡ญ
  • Laos ๐Ÿ‡ฑ๐Ÿ‡ฆ
  • Brunei ๐Ÿ‡ง๐Ÿ‡ณ
  • Timor-Leste ๐Ÿ‡น๐Ÿ‡ฑ
  • Mongolia ๐Ÿ‡ฒ๐Ÿ‡ณ
  • Kazakhstan ๐Ÿ‡ฐ๐Ÿ‡ฟ
  • Uzbekistan ๐Ÿ‡บ๐Ÿ‡ฟ
  • Kyrgyzstan ๐Ÿ‡ฐ๐Ÿ‡ฌ
  • Tajikistan ๐Ÿ‡น๐Ÿ‡ฏ
  • Turkmenistan ๐Ÿ‡น๐Ÿ‡ฒ
  • Afghanistan ๐Ÿ‡ฆ๐Ÿ‡ซ
  • Iran ๐Ÿ‡ฎ๐Ÿ‡ท
  • Iraq ๐Ÿ‡ฎ๐Ÿ‡ถ
  • Saudi Arabia ๐Ÿ‡ธ๐Ÿ‡ฆ
  • UAE ๐Ÿ‡ฆ๐Ÿ‡ช
  • Qatar ๐Ÿ‡ถ๐Ÿ‡ฆ
  • Kuwait ๐Ÿ‡ฐ๐Ÿ‡ผ
  • Bahrain ๐Ÿ‡ง๐Ÿ‡ญ
  • Oman ๐Ÿ‡ด๐Ÿ‡ฒ
  • Yemen ๐Ÿ‡พ๐Ÿ‡ช
  • Jordan ๐Ÿ‡ฏ๐Ÿ‡ด
  • Lebanon ๐Ÿ‡ฑ๐Ÿ‡ง
  • Syria ๐Ÿ‡ธ๐Ÿ‡พ
  • Israel ๐Ÿ‡ฎ๐Ÿ‡ฑ
  • Palestine ๐Ÿ‡ต๐Ÿ‡ธ
  • Turkey ๐Ÿ‡น๐Ÿ‡ท
  • Georgia ๐Ÿ‡ฌ๐Ÿ‡ช
  • Armenia ๐Ÿ‡ฆ๐Ÿ‡ฒ
  • Azerbaijan ๐Ÿ‡ฆ๐Ÿ‡ฟ

Oceania

  • Australia ๐Ÿ‡ฆ๐Ÿ‡บ
  • New Zealand ๐Ÿ‡ณ๐Ÿ‡ฟ
  • Fiji ๐Ÿ‡ซ๐Ÿ‡ฏ
  • Papua New Guinea ๐Ÿ‡ต๐Ÿ‡ฌ
  • Solomon Islands ๐Ÿ‡ธ๐Ÿ‡ง
  • Vanuatu ๐Ÿ‡ป๐Ÿ‡บ
  • New Caledonia ๐Ÿ‡ณ๐Ÿ‡จ
  • French Polynesia ๐Ÿ‡ต๐Ÿ‡ซ
  • Tonga ๐Ÿ‡น๐Ÿ‡ด
  • Samoa ๐Ÿ‡ผ๐Ÿ‡ธ
  • Kiribati ๐Ÿ‡ฐ๐Ÿ‡ฎ
  • Tuvalu ๐Ÿ‡น๐Ÿ‡ป
  • Nauru ๐Ÿ‡ณ๐Ÿ‡ท
  • Palau ๐Ÿ‡ต๐Ÿ‡ผ
  • Marshall Islands ๐Ÿ‡ฒ๐Ÿ‡ญ
  • Micronesia ๐Ÿ‡ซ๐Ÿ‡ฒ

Africa

  • South Africa ๐Ÿ‡ฟ๐Ÿ‡ฆ
  • Egypt ๐Ÿ‡ช๐Ÿ‡ฌ
  • Nigeria ๐Ÿ‡ณ๐Ÿ‡ฌ
  • Kenya ๐Ÿ‡ฐ๐Ÿ‡ช
  • Ethiopia ๐Ÿ‡ช๐Ÿ‡น
  • Tanzania ๐Ÿ‡น๐Ÿ‡ฟ
  • Uganda ๐Ÿ‡บ๐Ÿ‡ฌ
  • Ghana ๐Ÿ‡ฌ๐Ÿ‡ญ
  • Ivory Coast ๐Ÿ‡จ๐Ÿ‡ฎ
  • Senegal ๐Ÿ‡ธ๐Ÿ‡ณ
  • Mali ๐Ÿ‡ฒ๐Ÿ‡ฑ
  • Burkina Faso ๐Ÿ‡ง๐Ÿ‡ซ
  • Niger ๐Ÿ‡ณ๐Ÿ‡ช
  • Chad ๐Ÿ‡น๐Ÿ‡ฉ
  • Cameroon ๐Ÿ‡จ๐Ÿ‡ฒ
  • Central African Republic ๐Ÿ‡จ๐Ÿ‡ซ
  • Republic of the Congo ๐Ÿ‡จ๐Ÿ‡ฌ
  • Democratic Republic of the Congo ๐Ÿ‡จ๐Ÿ‡ฉ
  • Gabon ๐Ÿ‡ฌ๐Ÿ‡ฆ
  • Equatorial Guinea ๐Ÿ‡ฌ๐Ÿ‡ถ
  • Sรฃo Tomรฉ and Prรญncipe ๐Ÿ‡ธ๐Ÿ‡น
  • Angola ๐Ÿ‡ฆ๐Ÿ‡ด
  • Zambia ๐Ÿ‡ฟ๐Ÿ‡ฒ
  • Zimbabwe ๐Ÿ‡ฟ๐Ÿ‡ผ
  • Botswana ๐Ÿ‡ง๐Ÿ‡ผ
  • Namibia ๐Ÿ‡ณ๐Ÿ‡ฆ
  • Lesotho ๐Ÿ‡ฑ๐Ÿ‡ธ
  • Eswatini ๐Ÿ‡ธ๐Ÿ‡ฟ
  • Madagascar ๐Ÿ‡ฒ๐Ÿ‡ฌ
  • Mauritius ๐Ÿ‡ฒ๐Ÿ‡บ
  • Seychelles ๐Ÿ‡ธ๐Ÿ‡จ
  • Comoros ๐Ÿ‡ฐ๐Ÿ‡ฒ
  • Djibouti ๐Ÿ‡ฉ๐Ÿ‡ฏ
  • Somalia ๐Ÿ‡ธ๐Ÿ‡ด
  • Eritrea ๐Ÿ‡ช๐Ÿ‡ท
  • Sudan ๐Ÿ‡ธ๐Ÿ‡ฉ
  • South Sudan ๐Ÿ‡ธ๐Ÿ‡ธ
  • Libya ๐Ÿ‡ฑ๐Ÿ‡พ
  • Tunisia ๐Ÿ‡น๐Ÿ‡ณ
  • Algeria ๐Ÿ‡ฉ๐Ÿ‡ฟ
  • Morocco ๐Ÿ‡ฒ๐Ÿ‡ฆ
  • Western Sahara ๐Ÿ‡ช๐Ÿ‡ญ
  • Mauritania ๐Ÿ‡ฒ๐Ÿ‡ท
  • Gambia ๐Ÿ‡ฌ๐Ÿ‡ฒ
  • Guinea-Bissau ๐Ÿ‡ฌ๐Ÿ‡ผ
  • Guinea ๐Ÿ‡ฌ๐Ÿ‡ณ
  • Sierra Leone ๐Ÿ‡ธ๐Ÿ‡ฑ
  • Liberia ๐Ÿ‡ฑ๐Ÿ‡ท
  • Togo ๐Ÿ‡น๐Ÿ‡ฌ
  • Benin ๐Ÿ‡ง๐Ÿ‡ฏ

South America

  • Brazil ๐Ÿ‡ง๐Ÿ‡ท
  • Argentina ๐Ÿ‡ฆ๐Ÿ‡ท
  • Chile ๐Ÿ‡จ๐Ÿ‡ฑ
  • Colombia ๐Ÿ‡จ๐Ÿ‡ด
  • Peru ๐Ÿ‡ต๐Ÿ‡ช
  • Venezuela ๐Ÿ‡ป๐Ÿ‡ช
  • Ecuador ๐Ÿ‡ช๐Ÿ‡จ
  • Bolivia ๐Ÿ‡ง๐Ÿ‡ด
  • Paraguay ๐Ÿ‡ต๐Ÿ‡พ
  • Uruguay ๐Ÿ‡บ๐Ÿ‡พ
  • Guyana ๐Ÿ‡ฌ๐Ÿ‡พ
  • Suriname ๐Ÿ‡ธ๐Ÿ‡ท
  • Falkland Islands ๐Ÿ‡ซ๐Ÿ‡ฐ
  • French Guiana ๐Ÿ‡ฌ๐Ÿ‡ซ

Central America & Caribbean

  • Mexico ๐Ÿ‡ฒ๐Ÿ‡ฝ
  • Guatemala ๐Ÿ‡ฌ๐Ÿ‡น
  • Belize ๐Ÿ‡ง๐Ÿ‡ฟ
  • El Salvador ๐Ÿ‡ธ๐Ÿ‡ป
  • Honduras ๐Ÿ‡ญ๐Ÿ‡ณ
  • Nicaragua ๐Ÿ‡ณ๐Ÿ‡ฎ
  • Costa Rica ๐Ÿ‡จ๐Ÿ‡ท
  • Panama ๐Ÿ‡ต๐Ÿ‡ฆ
  • Cuba ๐Ÿ‡จ๐Ÿ‡บ
  • Jamaica ๐Ÿ‡ฏ๐Ÿ‡ฒ
  • Haiti ๐Ÿ‡ญ๐Ÿ‡น
  • Dominican Republic ๐Ÿ‡ฉ๐Ÿ‡ด
  • Puerto Rico ๐Ÿ‡ต๐Ÿ‡ท
  • Trinidad and Tobago ๐Ÿ‡น๐Ÿ‡น
  • Barbados ๐Ÿ‡ง๐Ÿ‡ง
  • Grenada ๐Ÿ‡ฌ๐Ÿ‡ฉ
  • Saint Lucia ๐Ÿ‡ฑ๐Ÿ‡จ
  • Saint Vincent and the Grenadines ๐Ÿ‡ป๐Ÿ‡จ
  • Antigua and Barbuda ๐Ÿ‡ฆ๐Ÿ‡ฌ
  • Saint Kitts and Nevis ๐Ÿ‡ฐ๐Ÿ‡ณ
  • Dominica ๐Ÿ‡ฉ๐Ÿ‡ฒ
  • Bahamas ๐Ÿ‡ง๐Ÿ‡ธ
  • Turks and Caicos Islands ๐Ÿ‡น๐Ÿ‡จ
  • Cayman Islands ๐Ÿ‡ฐ๐Ÿ‡พ
  • Bermuda ๐Ÿ‡ง๐Ÿ‡ฒ
  • Anguilla ๐Ÿ‡ฆ๐Ÿ‡ฎ
  • British Virgin Islands ๐Ÿ‡ป๐Ÿ‡ฌ
  • U.S. Virgin Islands ๐Ÿ‡ป๐Ÿ‡ฎ
  • Aruba ๐Ÿ‡ฆ๐Ÿ‡ผ
  • Curaรงao ๐Ÿ‡จ๐Ÿ‡ผ
  • Sint Maarten ๐Ÿ‡ธ๐Ÿ‡ฝ
  • Saint Martin ๐Ÿ‡ฒ๐Ÿ‡ซ
  • Saint Barthรฉlemy ๐Ÿ‡ง๐Ÿ‡ฑ
  • Guadeloupe ๐Ÿ‡ฌ๐Ÿ‡ต
  • Martinique ๐Ÿ‡ฒ๐Ÿ‡ถ

๐Ÿ”ง API Endpoints

Holiday Types

GET /api/holidays/types

Organization Holidays

GET /api/holidays/organization?year=2024
POST /api/holidays/organization
PUT /api/holidays/organization/:id
DELETE /api/holidays/organization/:id

Country Holidays

GET /api/holidays/countries
GET /api/holidays/countries/:country_code?year=2024
POST /api/holidays/import

Calendar View

GET /api/holidays/calendar?year=2024&month=1

๐Ÿ“Š Holiday Types

The system supports four types of holidays:

  1. Public Holiday - Official government holidays (Red)
  2. Company Holiday - Organization-specific holidays (Blue)
  3. Personal Holiday - Personal or optional holidays (Green)
  4. Religious Holiday - Religious observances (Yellow)

๐ŸŽฏ Usage Examples

Import US Holidays

const result = await holidayApiService.importCountryHolidays({
  country_code: 'US',
  year: 2024
});

Add Custom Holiday

const holiday = await holidayApiService.createOrganizationHoliday({
  name: 'Company Retreat',
  description: 'Annual team building event',
  date: '2024-06-15',
  holiday_type_id: 'company-holiday-id',
  is_recurring: true
});

Get Calendar View

const calendar = await holidayApiService.getHolidayCalendar(2024, 1);

๐Ÿ”„ Data Sources

The holiday data is sourced from the date-holidays npm package, which provides:

  • Official government holidays for 200+ countries
  • Religious holidays (Christian, Islamic, Jewish, Hindu, Buddhist)
  • Cultural and traditional holidays
  • Historical and commemorative days

๐Ÿ› ๏ธ Maintenance

Adding New Countries

  1. Add the country to the countries table
  2. Update the populate-holidays.js script
  3. Run the population script

Updating Holiday Data

# Re-run the holiday population script
./scripts/run-holiday-population.sh

๐Ÿ“ Notes

  • Holidays are stored for years 2020-2030 by default
  • The system prevents duplicate holidays on the same date
  • Imported holidays are automatically classified as "Public Holiday" type
  • All holidays support recurring annual patterns
  • The calendar view combines organization and country holidays

๐ŸŽ‰ Benefits

  • Global Compliance - Ensure compliance with local holiday regulations
  • Resource Planning - Better project scheduling and resource allocation
  • Team Coordination - Improved team communication and planning
  • Cost Management - Accurate billing and time tracking
  • Cultural Awareness - Respect for diverse cultural and religious practices