flutter_mmcalendar 0.0.8 flutter_mmcalendar: ^0.0.8 copied to clipboard
Myanmar calendar library for flutter application with many utility methods and calculations.
Flutter MMCalendar #
Myanmar Calendar package for Flutter
applications.
Installation ๐ป #
โ In order to start using flutter_mmcalendar
you must have the Flutter SDK installed on your machine.
Add flutter_mmcalendar
to your pubspec.yaml
:
dependencies:
flutter_mmcalendar:
Install it:
flutter packages get
Features #
Myanmar Date Converter
Western Date Converter
Astrological Converter
Myanmar Thingyan
holidays and other holidays calculation
Usage #
Import package
import 'package:flutter_mmcalendar/flutter_mmcalendar.dart';
Configure default calendarType
and language
. It is optional
.
void main() {
MmCalendarConfig.initDefault(
const MmCalendarOptions(
language: Language.myanmar,
),
);
runApp(const MyApp());
}
Sample Usage:
// Get MyanmarDate by year, month and day
final myanmarDate = MyanmarDateConverter.fromDate(2023, 10, 19);
// Output: 2567
final buddhistEra = myanmarDate.getBuddhistEra();
// Output: 1385
final year = myanmarDate.getYear();
// Output: Thadingyut
final monthName = myanmarDate.getMonthName();
// Output: full moon
final moonPhase = myanmarDate.getMoonPhase();
// Output: empty
final fortNightDay = myanmarDate.getFortnightDay();
// Output: Sunday
final weekday = myanmarDate.getWeekDay();
Myanmar Date format #
final myanmarDate = MyanmarDateConverter.fromDate(2023, 10, 19);
final resultStr = myanmarDate.formatByPatternAndLanguage(
pattern: 'S s k, B y k, M p f r En',
languageCatalog: LanguageCatalog(language: Language.myanmar),
);
// Output: แแฌแแแฌแแพแ
แบ แแ
แแ แแฏ, แแผแแบแแฌแแพแ
แบ แแแแ
แแฏ, แแฎแแแบแธแแปแฝแแบ แแแผแแบแท แแแบ แแแแบแนแแแฝแฑแแฑแท
// (or)
final resultStr = myanmarDate.formatByPatternAndLanguage(
pattern: 'S s k, B y k, M p f r En',
languageCatalog: LanguageCatalog(language: Language.english),
);
// Output: Sasana Year 2567 , Myanmar Year 1385 , Thadingyut full moon Sunday
Myanmar Date Patterns
Myanmar Date formats are specified by date pattern strings. The following pattern letters are defined ('S', 's', 'B', 'y', 'k', 'M', 'p', 'f', 'E', 'n', 'r', are reserved):
Letter | Date Component | Examples Myanmar | Examples English |
---|---|---|---|
S | Sasana year | แแฌแแแฌแแพแ แบ | Sasana Year |
s | Buddhist era | แแ แแ | 2561 |
B | Burmese year | แแผแแบแแฌแแพแ แบ | Myanmar Year |
y | Myanmar year | แแแแ | 1379 |
k | Ku | แแฏ | |
M | Month in year | แแซแแฑแซแแบ | Wagaung |
p | Moon phase | แแแแบแธ | waxing |
f | Fortnight Day | แ | 1 |
r | Yat | แแแบ | |
E | Day name in week | แแแแบแนแแฌ | Monday |
n | Nay | แแฑแท |
Available Converters #
MyanmarDateConverter
WesternDateConverter
AstroConverter
MyanmarDateConverter
// Get MyanmarDate by dart DateTime
final myanmarDate = MyanmarDateConverter.fromDateTime(DateTime.now());
// Get MyanmarDate by custom year, month and day
final myanmarDate = MyanmarDateConverter.fromDate(2023, 10, 19);
// Get MyanmarDate by custom year, month, day, hour, minute and second
final myanmarDate = MyanmarDateConverter.fromDateAndTime(2023, 10, 19, 12, 30, 00);
// Get MyanmarDate by julian day numbers
final myanmarDate = MyanmarDateConverter.fromJulianDate(2460237);
WesternDateConverter
// By julian day number
final westernDate = WesternDateConverter.fromJulianDate(julianDate);
// By MyanmarDate
final westernDate = WesternDateConverter.fromMyanmarDate(myanmarDate);
AstroConverter
final astro = AstroConverter.convert(myanmarDate);
Available Converting Logics #
AstroLogic
getAstro()
MyanmarDateLogic
julianToMyanmarDate()
myanmarDateToJulian()
myanmarDateToJulianWithDate()
toJulian()
getMyanmarMonths()
WesternDateLogic
julianToWestern()
westernToJulian()
westernToJulianWithTime()
toJulian()
getJulianDayNumberOfStartOfMonth()
getJulianDayNumberOfEndOfMonth()
getLengthOfMonth()
Available Holidays Calculation #
-
ThingyanCalculator
getMyanmarThingyanDaysFromDateTime()
getMyanmarThingyanDays()
final thingyanHolidays = ThingyanCalculator.getMyanmarThingyanDaysFromDateTime(DateTime.now());
getThingyanFromDateTime()
getThingyan()
-
HolidayCalculator
getHolidays()
myanmarHolidays()
thingyanHolidays()
englishHolidays()
englishAnniversaryDays()
myanmarAnniversaryDays()
getAnniversaries()
otherHolidays()
Astrological Information #
final myanmarDate = MyanmarDateConverter.fromDateTime(DateTime.now());
final astro = AstroConverter.convert(myanmarDate);
// แกแแผแญแแนแแ
แฏแแบ
final amyeittasote = astro.getAmyeittasote();
// แแแบแแฌแแฌ, แแผแฟแแซแธ, แแฝแแบแธแแฝแฒแแผแฟแแซแธ
final astrologicalDay = astro.getAstrologicalDay();
// "Binga", "Atun", "Yaza", "Adipati", "Marana", "Thike", "Puti"
final mahabote = astro.getMahabote();
// แแแฌแแแบแแผแแบแธ
final mahayatkyan = astro.getMahayatkyan();
// "West", "North", "East", "South"
final nagahle = astro.getNagahle();
// แแแซแธแแฑแซแบ
final nagapor = astro.getNagapor();
// "Ogre", "Elf", "Human"
final nakhat = astro.getNakhat();
// แฅแแฏแแบ
final sabbath = astro.getSabbath();
// แแพแแบแธแแแบ
final shanyat = astro.getShanyat();
// แแแฌแธแแญแฏ
final thamanyo = astro.getThamanyo();
// แแแฌแธแแผแฐ
final thamaphyu = astro.getThamaphyu();
// แแซแแแญแแนแแฏแแผแฎแธ
final warameittugyi = astro.getWarameittugyi();
// แแซแแแญแแนแแฏแแแบ
final warameittunge = astro.getWarameittunge();
// แแแบแแฏแแบ
final yatpote = astro.getYatpote();
// แแแบแแฏแแบแแฌ
final yatyotema = astro.getYatyotema();
// "แแฏแฟแแพแ
แบ", "แแฌแแแพแ
แบ", "แแนแแแญแฏแแบแแถแแ
แนแแญแฏแแบแแแพแ
แบ", "แ
แแบแแพแ
แบ", "แแญแแปแแบแแพแ
แบ", "แ
แญแฟแแพแ
แบ", "แกแฌแแแบแแพแ
แบ", "แแแแแบแแพแ
แบ",
// "แแแนแแผแแถแแ
แนแแฏแถแแบแแพแ
แบ", "แกแฌแแญแแบแแพแ
แบ", "แแผแแญแฏแแบแแพแ
แบ", "แแผแญแแนแแแญแฏแแบแแพแ
แบ"
final yearName = astro.getYearName();
You can also check these days by calling is
prefix properties.
Example:
// It will return true or false
final isAmyeittasote = astro.isAmyeittasote;
Concept reference resources #
Algorithm, Program and Calculation of Myanmar Calendar
- https://cool-emerald.blogspot.com/2013/06/algorithm-program-and-calculation-of.html (Dr Yan Naing Aye)
C++ and Javascript Implementation
Java Library Implementation