UNPKG

nanakshahi-ical

Version:

Nanakshahi calendar iCal generator using official SGPC Jantri data with enhanced accuracy for Sikh religious observances.

186 lines (126 loc) โ€ข 5.52 kB
# ๐Ÿ“… Nanakshahi Calendar iCal Generator A Nanakshahi calendar system that generates accurate iCal files for Sikh religious observances, using data from official SGPC sources. ## ๐Ÿ™ **About This Project** This is **not affiliated with SGPC** but uses data from their official calendar publications to provide enhanced calendar accuracy for everyone. ### ๐Ÿ“š **Data Sources** - **Primary**: Official SGPC Jantri publications (https://sgpc.net) - **Enhancement**: Corrections and validation from various sources ## ๐Ÿš€ **Key Features** โœ… **SGPC Compliant**: July 5th correctly shows "Miri Piri Divas" (not "Parkash Divas") โœ… **Variable Month Lengths**: Jeth 2025 has 32 days as per SGPC calendar โœ… **Enhanced Accuracy**: Improved with corrections from SGPC official sources โœ… **Easy Integration**: Drop-in replacement for nanakshahi-js โœ… **Automated Updates**: GitHub Actions for yearly calendar updates โœ… **Open Source**: GitHub-based corrections database โœ… **Web Calendar**: Beautiful interactive calendar interface ## ๐ŸŒ **Live Web Calendar** View the interactive Enhanced Nanakshahi Calendar online: **๐Ÿ”— https://janpreet.github.io/nanakshahi-ical/** ## ๐Ÿ“ฆ **Quick Start** ### Install ```bash npm install nanakshahi-ical ``` ### Generate iCal File ```bash node main.js ``` This creates `nanakshahi.ics` with all Gurpurabs and events for the current year. ### Use in Your Project ```javascript const sgpc = require('./sgpc-nanakshahi') // Get all Gurpurabs for current year const gurpurabs = sgpc.getAllGurpurabsForYear(557) // 2025 // Convert dates const gregorianDate = new Date('2025-07-05') const nanakshahiDate = sgpc.getNanakshahiDate(gregorianDate) console.log(nanakshahiDate) // 21 Harh 557 // Check for Gurpurabs on a specific date const gurpurabsToday = sgpc.getGurpurabsForDay(gregorianDate) console.log(gurpurabsToday) // [{ en: 'Miri Piri Divas', pa: 'เจฎเฉ€เจฐเฉ€ เจชเฉ€เจฐเฉ€ เจฆเจฟเจตเจธ', type: 'gurpurab' }] ``` ## ๐Ÿ”ง **Update Process** I've set up multiple ways to keep the calendar accurate: 1. **SGPC Corrections** โ†’ Official calendar data (highest priority) 2. **Corrections Database** โ†’ Crowd-sourced corrections 3. **nanakshahi-js** โ†’ Baseline calculations 4. **Manual Input** โ†’ When needed ### Corrections Database The `sgpc-corrections.json` file contains verified corrections: - Month length adjustments - Gurpurab date corrections - Historical validation data ## ๐Ÿ› ๏ธ **Development & Testing** ### Run Tests ```bash npm test # All tests npm run test-sgpc # SGPC compliance tests npm run validate-calendar # Calendar validation ``` ### Code Coverage I use [CodeCov](https://codecov.io) to track test coverage. Coverage reports are automatically uploaded on: - Every push to main branch - All pull requests - Calendar update workflows [![codecov](https://codecov.io/gh/janpreet/nanakshahi-ical/graph/badge.svg?token=OMQ92VQEBI)](https://codecov.io/gh/janpreet/nanakshahi-ical) ### Available Scripts ```bash npm run fetch-calendar # Fetch latest SGPC data npm run validate-calendar # Validate calendar data npm run update-calendar # Full update process npm run build:web # Build web calendar ``` ## ๐Ÿ”„ **API Compatibility** This works as a drop-in replacement for nanakshahi-js: ```javascript // Original nanakshahi-js approach const nanakshahi = require('nanakshahi') // Enhanced approach (same API, additional features!) const sgpc = require('./sgpc-nanakshahi') // Both work the same way const date = sgpc.getNanakshahiDate(new Date('2025-07-05')) ``` ## ๐Ÿค **Contributing** Found an issue with the calendar? Here's how to help: ### Quick Calendar Fix Edit `sgpc-corrections.json` directly: ```json { "557": { "corrections": { "july_5": "miri_piri_divas" } } } ``` ### Adding SGPC Data 1. **Get official SGPC calendar** (usually PDF from https://sgpc.net) 2. **Extract month lengths** and Gurpurab dates 3. **Add to corrections database** 4. **Run validation** with `npm run validate-calendar` 5. **Submit pull request** ### Reporting Issues - ๐Ÿ“… **Calendar issues**: Compare with official SGPC calendar - ๐Ÿ› **Bugs**: Include steps to reproduce - ๐Ÿ’ก **Features**: Explain the use case ## ๐Ÿ“„ **License** MIT License - feel free to use this in your projects! ## ๐Ÿ›ก๏ธ **Security & Community** ### Security Found a security vulnerability? Please report it responsibly: - ๐Ÿ“ง **Email**: singh@janpreet.com with subject "SECURITY: [Brief Description]" - ๐Ÿ”’ **Private**: We handle security issues privately until fixed - โฑ๏ธ **Response**: Within 48 hours See [SECURITY.md](SECURITY.md) for detailed security reporting guidelines. ### Community Guidelines This project follows a Code of Conduct to ensure a welcoming environment for all contributors: - ๐Ÿค **Respectful**: Be respectful of all viewpoints and experiences - ๐ŸŽฏ **Accuracy**: Prioritize calendar accuracy and SGPC compliance - ๐Ÿ™ **Seva Spirit**: Maintain the service-oriented nature of the project See [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) for full community guidelines. ## ๐Ÿ™ **Acknowledgments** - **SGPC** for maintaining the official Nanakshahi calendar - **nanakshahi-js contributors** for the excellent foundation - **Everyone** who provides feedback and validation --- **๐Ÿ™ This project serves the Sikh community with accurate calendar data sourced from official SGPC publications and enhanced through various contributions.**