flutter_khmer_chankitec 0.0.5
flutter_khmer_chankitec: ^0.0.5 copied to clipboard
A Flutter plugin for Khmer lunar calendar (Chhankitek/ចន្ទគតិ) calculations. Convert Gregorian dates to Khmer lunar dates with full support for Buddhist calendar features including Sila days detection.
flutter_khmer_chankitec #
A Flutter plugin for Khmer lunar calendar (Chhankitek/ចន្ទគតិ) calculations and date conversions. Powered by the robust astronomical logic from momentkh.
💝 Support This Project #
Scan to donate via KHQR (ស្កេនដើម្បីបរិច្ចាគតាម KHQR)
Features #
- ✅ High Precision: Uses astronomical calculations for New Year (Moha Songkran) and Era transitions.
- ✅ Standard Compliant: Logic ported from the widely used
momentkhlibrary. - ✅ Comprehensive: Handles Leap Months (Athikameas) and Leap Days (Chantreathimeas).
- ✅ Pure Dart: Zero dependencies, works on all platforms.
Installation #
dependencies:
flutter_khmer_chankitec: ^0.0.5
Usage #
import 'package:flutter_khmer_chankitec/flutter_khmer_chankitec.dart';
// Get current Khmer lunar date
final lunarDate = Chhankitek.now();
print(lunarDate.toString());
// Output: ថ្ងៃអាទិត្យ ១០ កើត ខែបុស្ស ឆ្នាំរោង ឆស័ក ពុទ្ធសករាជ ២៥៦៨
// ត្រូវនឹងថ្ងៃទី០៨ ខែមករា ឆ្នាំ២០២៥
// Convert specific date
final date = Chhankitek.fromDate(DateTime(2024, 4, 13));
// Check special days
if (lunarDate.isSilaDay) print('Today is Sila day! 🙏');
if (lunarDate.isFullMoon) print('Full moon! 🌕');
// Access individual properties
print('Day of Week: ${lunarDate.dayOfWeek}');
print('Lunar Day: ${lunarDate.lunarDay}');
print('Lunar Month: ${lunarDate.lunarMonth}');
print('Lunar Zodiac: ${lunarDate.lunarZodiac}');
print('Lunar Era: ${lunarDate.lunarEra}');
print('Lunar Year: ${lunarDate.lunarYear}');
API #
Main Methods #
Chhankitek.now()- Get current Khmer lunar dateChhankitek.fromDate(DateTime)- Convert Gregorian to lunar date
KhmerLunarDate Properties #
dayOfWeek: Day of week in KhmerlunarDay: Lunar day with phase (e.g., ១ កើត)lunarMonth: Lunar month namelunarZodiac: Zodiac animallunarEra: Era namelunarYear: Buddhist Era yearsolarDate: Formatting for solar date infoisSilaDay,isFullMoon,isNewMoon: Helper booleans
Credits #
This package implements the calculation logic from momentkh by Thyrith Sor. Full credit for the astronomical algorithms goes to the original author and contributors of that library.
License #
MIT License - Copyright (c) 2026 Veng Ann