Nepali Calendar Package

The Nepali Calendar Package is a powerful tool for working with the Nepali calendar system in your Flutter applications. It provides various functionalities to convert dates between the Gregorian and Nepali calendars, display Nepali calendar events, and perform date calculations.

Features

  • Conversion between Gregorian and Nepali dates
  • Displaying Nepali calendar events
  • Date calculations such as adding or subtracting days, months, or years
  • Formatting dates in the Nepali calendar system

Installation

To use the Nepali Calendar Package in your Flutter project, add the following dependency to your pubspec.yaml file:

dependencies:
  nepali_calendar: ^1.0.0

Then, run flutter pub get to fetch the package.

Usage

Import the package in your Dart file:

import 'package:nepali_calendar/nepali_calendar.dart';

Now, you can start using the various functionalities provided by the package. Here are a few examples:

// Convert Nepali date to Gregorian date
DateTime gregorianDate = nepaliDate.toDateTime();

// Convert Gregorian date to Nepali date
NepaliDateTime nepaliDate = NepaliDateTime.fromDateTime(DateTime.now());

// Add 5 days to a Nepali date
NepaliDateTime newDate = nepaliDate.add(Duration(days: 5));

// Format a Nepali date
String formattedDate = NepaliDateFormat("yyyy-MM-dd").format(nepaliDate);

// Display Nepali calendar events
List<NepaliEvent> events = [
    NepaliEvent(
        date: NepaliDateTime(2079, 1, 1),
        title: 'New Year',
        description: 'Celebrate the start of the Nepali New Year!'
    ),
    NepaliEvent(
        date: NepaliDateTime(2079, 4, 14),
        title: 'Bisket Jatra',
        description: 'Enjoy the vibrant festival of Bisket Jatra!'
    ),
];

// Display a calendar with events
NepaliCalendar(
    events: events,
    initialDate: NepaliDateTime.now(),
    onDateSelected: (date) {
        // Handle date selection
    },
);

For more details on how to use the Nepali Calendar Package, refer to the documentation.

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue on the GitHub repository.

License

This package is released under the MIT License.