- 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.
352 lines
7.9 KiB
Markdown
352 lines
7.9 KiB
Markdown
# ๐ 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:
|
|
|
|
```bash
|
|
# 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:
|
|
|
|
```bash
|
|
# 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
|
|
```http
|
|
GET /api/holidays/types
|
|
```
|
|
|
|
### Organization Holidays
|
|
```http
|
|
GET /api/holidays/organization?year=2024
|
|
POST /api/holidays/organization
|
|
PUT /api/holidays/organization/:id
|
|
DELETE /api/holidays/organization/:id
|
|
```
|
|
|
|
### Country Holidays
|
|
```http
|
|
GET /api/holidays/countries
|
|
GET /api/holidays/countries/:country_code?year=2024
|
|
POST /api/holidays/import
|
|
```
|
|
|
|
### Calendar View
|
|
```http
|
|
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
|
|
```javascript
|
|
const result = await holidayApiService.importCountryHolidays({
|
|
country_code: 'US',
|
|
year: 2024
|
|
});
|
|
```
|
|
|
|
### Add Custom Holiday
|
|
```javascript
|
|
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
|
|
```javascript
|
|
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
|
|
|
|
```bash
|
|
# 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 |