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

套件詳情v1.0.6

buddhist_datetime_dateformat

一個 Dart 套件,幫助開發者取得 DateTime 的佛曆格式年份,也支援 DateFormatter

近 30 天下載
77
喜歡數
24
Pub 分數
30

安裝套件

flutter pub add buddhist_datetime_dateformat

套件介紹

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

一個 Dart 套件,讓開發者能夠將 DateTime 值轉換並格式化為佛教曆法系統,此系統常見於泰國及其他東南亞國家。它提供了一個 DateFormatter 工具,用於在佛教年份中保持一致的日期格式。該套件簡化了在 Flutter 應用程式中處理佛教紀年日期的作業,確保跨不同地區的準確呈現。它支援與現有日期運算的無縫整合,非常適合針對使用佛教曆法地區使用者的應用程式。

適用情境

  • 將格里高利日期轉換為佛教曆
  • 以佛教年份格式化日期
  • 建構區域特定的日曆應用
  • 以泰語或佛教紀元格式顯示日期
  • 支援多語言日期顯示

主要特色

  • 將 DateTime 轉換為佛教曆法年份
  • 包含 DateFormatter 工具類
  • 支援佛教紀年本地化
  • 與 Flutter 的輕鬆整合
  • 格里曆年份的準確偏移量

適合對象

  • 面向泰國或東南亞的Flutter應用
  • 需要佛教日曆支援的應用程式
  • 使用地區日期格式的開發人員
  • 日曆和排程應用程式
  • 國際化日期處理

使用建議

  • 需要手動處理月份/日期邊界
  • 僅限佛教曆法轉換
  • 無內建時區支援
  • 不適用於非佛教曆法系統
  • 依賴於正確的格里高利曆輸入以實現準確轉換

原始 README

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

Buddhist Calendar DateTime and DateFormatter for Dart and Flutter

If this helps you out of problem, please give it a like in pub.dev or a star on github. :smile:

ภาษาไทยอ่านวิธีใช้ที่นี่นะครับ

2020-06-05_17-31-47

These are extension that you can get DateTime and DateFormat in Buddhist calendar's format.

I implemented these extensions for use in Thai language project. But you can contribute to add more support for other countries who also use Buddhist calendar in the apps.

Getting Started

1. Setup

Install package via pubspec.yaml

dependencies:
  intl: ^0.16.1  
  buddhist_datetime_dateformat: ^1.0.1

2. Initialization

Then go to your main.dart. Let's import and write some Initialization code.

// need this for `Intl.defaultLocale = "th";`
import 'package:intl/intl.dart';
// need this for initializeDateFormatting()
import 'package:intl/date_symbol_data_local.dart';

// This lets magic happen!
import 'package:buddhist_datetime_dateformat/buddhist_datetime_dateformat.dart';

void main() {

  // set your default locale here. It will be applied to DateFormat autmomatically.
  Intl.defaultLocale = "th";
  initializeDateFormatting();

  runApp(MyApp());
}

3. Use it

  • You will found .yearInBuddhistCalendar property in DateTime's instance. This will return converted year value into Buddhist era.
  • Also .formatInBuddhistCalendarThai(datetime) method in DateFormat which return correct format for Thai language if you pass DateTime's instance into it.
var now = DateTime.now();
var onlyBuddhistYear = now.yearInBuddhistCalendar;

var formatter = DateFormat.yMMMMEEEEd();
var dateInBuddhistCalendarFormat = formatter.formatInBuddhistCalendarThai(now);

Open for contribution

If you want to contribute, there are several countries that also use Buddhist calendar:

  • Thailand
  • Cambodia
  • Laos
  • MyanMar
  • Sri Lanka
  • Malaysia
  • Singapore

Reference: https:en.wikipedia.org/wiki/Buddhist_calendar

I don't know other langauge need a prefix for Buddhist year like in Thailand (พ.ศ.). If yes, so you can help me correct their format by update the code with your customization. Just make pull request.

所屬分類

依賴

依賴清單 1 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。