Search packages, repositories and app categories

Package detailsv3.0.1

hijri

Convert between Hijri Calendar and Gregorian Calendar date support Arabic and English Local.

AndroidiOSWebmacOSWindowsLinux
30-day downloads
36.3K
Likes
145
Pub points
140

Install package

flutter pub add hijri

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

The hijri package provides seamless conversion between Hijri (Islamic) and Gregorian calendar dates in Flutter applications. It supports both Arabic and English locales, making it ideal for apps targeting Muslim communities or requiring religious date calculations. The package is lightweight, easy to integrate, and works across all major platforms including Android, iOS, Web, macOS, Windows, and Linux. It handles date formatting and parsing with accuracy, ensuring reliable results for Islamic calendar events like Ramadan and Eid.

Use cases

  • Islamic event scheduling
  • Multilingual calendar display
  • Religious app development
  • Date conversion in finance apps
  • Cross-calendar compatibility

Key features

  • Hijri-Gregorian date conversion
  • Arabic and English locale support
  • Platform-agnostic implementation
  • Accurate Islamic calendar calculations
  • Simple API integration

Suitable for

  • Apps for Muslim users
  • Religious or cultural applications
  • International date handling
  • Mobile and web apps needing dual calendars
  • Developers supporting multiple languages

Considerations

  • Requires understanding of Hijri calendar rules
  • Limited to date-level precision
  • No time zone handling
  • Depends on accurate input dates
  • May need additional formatting for UI display

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

Hijri

Hijri Calendar Converter

Usage
//Suppose current gregorian data/time is: Mon May 29 00:27:33  2018
  var _today = HijriCalendar.now();
  print(_today.hYear); // 1439
  print(_today.hMonth); // 9
  print(_today.hDay); // 14
  print(_today.getDayName()); // 14
  // Get month length in days
  print(_today.lengthOfMonth); // 30 days
  print(_today.toFormat("MMMM dd yyyy")); //Ramadan 14 1439
Change Local
  HijriCalendar.setLocal(locale);
Add New Locale
  HijriCalendar.addLocale(locale, {
    'long': ...,
    'short': ...,
    'days': ...,
    'short_days': ...
  });
  HijriCalendar.setLocal(locale);
From Gregorian to Ummalqura
var h_date = HijriCalendar.fromDate(DateTime(2018, 11, 12));
print(h_date.toString()); //04/03/1440H
print(h_date.getShortMonthName()); //Rab1
print(h_date.getLongMonthName()); //Rabi' al-awwal
print(h_date.lengthOfMonth); // 29 days
Check if date is valid
  //
  var _check_date = HijriCalendar();
  _check_date.hYear = 1439;
  _check_date.hMonth = 11;
  _check_date.hDay = 30;
  print(_check_date.isValid()); // false -> This month is only 29 days
From Ummalqura to Gregorian
  //From Ummalqura to Gregorian
  var g_date = HijriCalendar();
  print(g_date.hijriToGregorian(1415, 7, 27)); //1994-12-29 00:00:00.000
Format
  var _format = HijriCalendar.now();
  print(_format.fullDate()); //Thulatha, Ramadan 14, 1439 h
  print(_format.toFormat("mm dd yy")); //09 14 39
Compare
  //Suppose current hijri data is: Thulatha, Ramadan 14, 1439 h
  print(_today.isAfter(1440, 11, 12)); // false
  print(_today.isBefore(1440, 11, 12)); // true
  print(_today.isAtSameMomentAs(1440, 11, 12)); // false

Categories

Source repository

Projects using this package