lunar_calendar_converter 1.0.3 lunar_calendar_converter: ^1.0.3 copied to clipboard
This package contains a converter to convert calendar from one to another between lunar calendar and solar calendar, it can also convert a date to Chinese text with Tiangan and Dizhi. For more details [...]
Using #
Import the library:
import 'lunar_solar_converter.dart';
You can use this converter to convert calendar from one to another between lunar calendar and solar calendar. For example:
Lunar lunar = Lunar(lunarYear: 2022, lunarMonth: 4, lunarDay: 1, isLeap: false);
Solar solar = LunarSolarConverter.lunarToSolar(lunar);
print(solar);
You will get 公元2022年5月1日
.
or
Solar solar = Solar(solarYear: 2018, solarMonth: 8, solarDay: 22);
Lunar lunar = LunarSolarConverter.solarToLunar(solar);
print(lunar);
You will get 戊戌年(2018)七月十二
.