chinese_lunar_calendar 0.0.2 copy "chinese_lunar_calendar: ^0.0.2" to clipboard
chinese_lunar_calendar: ^0.0.2 copied to clipboard

A Dart Package for creating Chinese Lunar Calendar. It runs locally and doesn't depend on any remote API. 中国万年历查询, 本地运行,不依赖远程API。

Chinese Lunar Calendar #

中国万年历查询

本项目参考 cnLunar, 用Dart重写成一个Dart Package。

本地运行,无远程API依赖。

Dart CI License Pub Package publisher

功能 #

  • 查询春节日期.
  • 查询农历日期、干支纪年、生肖。

安装 #

Run this command:

With Dart:

$ dart pub add chinese_lunar_calendar

With Flutter:

$ flutter pub add chinese_lunar_calendar

示例 #

查询春节日期 #

import 'package:chinese_lunar_calendar/chinese_lunar_calendar.dart';

void main() {
  // 输入查询日期
  final lunarCalendar = LunarCalendar(dateTime: DateTime(2023, 6, 6));
  print('2023年6月6日');
  
  // 输出春节阳历日期
  print('春节: ${lunarCalendar.chineseNewYearString}');
  
  // 输出阴历数字
  print(
      '阴历数字: ${lunarCalendar.lunarDate.year}, ${lunarCalendar.lunarDate.month}, ${lunarCalendar.lunarDate.day}, 闰月:${lunarCalendar.lunarDate.isLeapMonth}');
  
  // 输出阴历汉字
  print('阴历汉字: ${lunarCalendar.lunarDate.fullCNString}');
}

输出结果

2023年6月6日
春节: 2023 年 1 月 22 日
阴历数字: 2023, 4, 19, 闰月:false
阴历汉字: 二零二三 癸卯[兔]年 四月大十九
6
likes
0
pub points
67%
popularity

Publisher

verified publishermintminter.dev

A Dart Package for creating Chinese Lunar Calendar. It runs locally and doesn't depend on any remote API. 中国万年历查询, 本地运行,不依赖远程API。

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

collection, equatable

More

Packages that depend on chinese_lunar_calendar