搜尋套件、儲存庫與 APP 分類

套件詳情v3.0.1

hijri

在希吉拉曆與格里高利曆之間進行日期轉換,支援阿拉伯語和英語本地化。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
3.6萬
喜歡數
145
Pub 分數
140

安裝套件

flutter pub add hijri

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

hijri 套件提供在 Flutter 應用程式中,伊斯蘭曆(Hijri)與格里高利曆日期之間的無縫轉換。它支援阿拉伯語和英文地區設定,非常適合針對穆斯林社群或需要宗教日期計算的應用程式。該套件輕量級、易於整合,並可在所有主要平台(包括 Android、iOS、Web、macOS、Windows 和 Linux)上運作。它能準確處理日期格式化與解析,確保在齋月和開齋節等伊斯蘭曆法事件中獲得可靠結果。

適用情境

  • 伊斯蘭活動安排
  • 多語言日曆顯示
  • 宗教應用開發
  • 金融應用程式中的日期轉換
  • 跨日曆相容性

主要特色

  • 伊斯蘭曆-格里高利曆日期轉換
  • 阿拉伯語和英語區域設定支援
  • 平台無關的實作
  • 精確的伊斯蘭曆計算
  • 簡單的 API 結合

適合對象

  • 為穆斯林用戶提供的應用程式
  • 宗教或文化應用
  • 國際日期處理
  • 需要雙日曆的行動和網頁應用
  • 支援多種語言的開發者

使用建議

  • 需要了解伊斯蘭曆法規則
  • 僅限日期級別精度
  • 無時區處理
  • 取決於準確的輸入日期
  • 可能需要額外的格式化以用於UI顯示

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

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

所屬分類

原始碼儲存庫

使用此套件的專案