搜索插件、代码仓与 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 项

源码仓库

使用此插件的项目

暂无相关数据。