A comprehensive React and React Native library for Bikram Sambat (Nepali) calendar with holidays support. Cross-platform compatible.
npm install @samirkoirala/bs-calendar-reactA comprehensive React and React Native library for Bikram Sambat (Nepali calendar) with built-in holidays support. Fully cross-platform compatible.



- 🗓️ Accurate BS to AD conversion and vice versa
- 🎉 Built-in Nepali holidays with complete data
- 📅 Calendar grid generation with month navigation
- 🕐 Cross-platform timezone handling (Asia/Kathmandu)
- ⚛️ React hook for seamless integration
- 📱 Full React Native support (iOS, Android, Web, Windows, macOS)
- 📱 TypeScript support with complete type definitions
- 🚀 Lightweight and performant
✅ React: Web applications
✅ React Native: iOS, Android, Web, Windows, macOS
✅ Cross-platform: Works seamlessly everywhere
✅ TypeScript: Full type definitions included
``bash`
npm install @samirkoirala/bs-calendar-reactor
yarn add @samirkoirala/bs-calendar-react
`typescript
import React from 'react';
import { useCalendar } from '@samirkoirala/bs-calendar-react';
function CalendarComponent() {
const {
today,
monthsWithHolidays,
currentBikYear,
currentBikMonth
} = useCalendar({});
return (
$3
`typescript
import React from 'react';
import { View, Text, ScrollView } from 'react-native';
import { useCalendar } from '@samirkoirala/bs-calendar-react';export default function CalendarScreen() {
const { today, monthsWithHolidays } = useCalendar({});
return (
Nepali Calendar
Today: {today.date}
{monthsWithHolidays.map((day, index) => (
padding: 8,
backgroundColor: day.holiday?.length ? '#ffebee' : 'white'
}}>
Day {day.day}
{day.holiday?.length > 0 && (
{day.holiday.join(', ')}
)}
))}
);
}
`📚 API Reference
$3
Main React hook for calendar functionality.
`typescript
interface Props {
year?: number; // Bikram Sambat year
month?: number; // Bikram Sambat month (1-12)
}const {
today, // Today's date info
monthsWithHolidays, // Calendar days with holidays
currentBikYear, // Current BS year
currentBikMonth, // Current BS month
currentBikDay, // Current BS day
getThisMonths, // Function to get current month days
} = useCalendar({ year: 2081, month: 3 });
`$3
`typescript
import {
getCurrentDate,
daysInMonth,
bikramSambat
} from '@samirkoirala/bs-calendar-react';// Get current BS date
const today = getCurrentDate();
// { year: 2082, month: 3, day: 27 }
// Get days in a specific month
const days = daysInMonth(2082, 3); // 32 days (Asadh can have 32 days!)
// Direct converter access
const bsDate = bikramSambat.toBik('2025-07-11');
const adDate = bikramSambat.toGreg(2082, 3, 27);
`🌟 Unique Features
$3
- Variable month lengths: BS months can have 29-32 days
- 32-day months: Months like Asadh (असार), Jestha (जेठ) can have 32 days
- Accurate holidays: Complete Nepali holiday calendar included
$3
| Month | English | Nepali | Typical Days |
|-------|---------|--------|--------------|
| 1 | Baisakh | बैशाख | 30-31 |
| 2 | Jestha | जेठ | 31-32 |
| 3 | Asadh | असार | 31-32 |
| 4 | Shrawan | श्रावण | 31-32 |
| 5 | Bhadra | भदौ | 31 |
| 6 | Ashwin | आश्विन | 30-31 |
| 7 | Kartik | कार्तिक | 29-30 |
| 8 | Mangsir | मंसिर | 29-30 |
| 9 | Poush | पुष | 29-30 |
| 10 | Magh | माघ | 29-30 |
| 11 | Falgun | फाल्गुण | 29-30 |
| 12 | Chaitra | चैत्र | 30-31 |
📱 React Native Documentation
For detailed React Native usage, examples, and platform-specific guides:
- React Native Usage Guide
- Example App Setup
🔧 Advanced Usage
$3
`typescript
const [year, setYear] = useState(2081);
const [month, setMonth] = useState(3);const { monthsWithHolidays } = useCalendar({ year, month });
const nextMonth = () => {
if (month < 12) setMonth(month + 1);
else { setYear(year + 1); setMonth(1); }
};
`$3
`typescript
const { monthsWithHolidays } = useCalendar({});
const holidays = monthsWithHolidays.filter(day => day.holiday?.length > 0);
`🎯 TypeScript Support
Full TypeScript definitions included:
`typescript
interface IMonthDayWithHoliday {
date: string; // YYYY-MM-DD format
month: number; // Month number (1-12)
day: number; // Day number
bs_date: string; // Bikram Sambat date string
holiday: string[]; // Array of holiday names
}
``Contributions are welcome! Please feel free to submit issues and pull requests.
ISC License - see LICENSE file for details.
- Author: Pradip Chapagain
- Bikram Sambat Converter: Based on accurate BS calendar algorithms
- Holiday Data: Official Nepal holiday calendar
---
Made with ❤️ for the Nepali developer community