flutter_mmcalendar 1.1.0 flutter_mmcalendar: ^1.1.0 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
Western Date
Astrological Information
Holidays
- Myanmar Thingyan holidays and other holidays.
Usage #
Import package
import 'package:flutter_mmcalendar/flutter_mmcalendar.dart';
Sample Usage:
// Default
final mmCalendar = MmCalendar(
config: MmCalendarConfig.defaultConfig(),
);
// English language config
final mmCalendar = MmCalendar(
config: MmCalendarConfig.englishLanguage(),
);
// Specific language and calendar type
final mmCalendar = MmCalendar(
config: const MmCalendarConfig(
calendarType: CalendarType.gregorian,
language: Language.myanmar,
),
);
And use it
// Get MyanmarDate by year, month and day
final myanmarDate = mmCalendar.fromDate(2023, 10, 19);
Available configs:
MmCalendarConfig.defaultConfig()
MmCalendarConfig.myanmarLanguage()
MmCalendarConfig.zawgyiLanguage()
MmCalendarConfig.englishLanguage()
MmCalendarConfig.monLanguage()
MmCalendarConfig.karenLanguage()
MmCalendarConfig.taiLanguage()
Available languages:
english
myanmar
- myanmar unicodezawgyi
- myanmar zawgyimon
karen
tai
Other usages:
// Date conversion methods.
final myanmarDate = mmCalendar.fromDateTime(DateTime.now());
mmCalendar.fromDate(2023, 7, 27);
mmCalendar.fromDateAndTime(2023, 7, 27, 10, 30, 01);
mmCalendar.fromJulian(2456599);
final westernDate = mmCalendar.getWesternDateFromJulianDay(2456599);
/// Astrological information
final astro = myanmarDate.astro;
final astroByLanguage = myanmarDate.getAstro(
languageCatalog: LanguageCatalog.myanmar(),
);
astro.getMahabote();
// All Holidays
List<String> holidays = myanmarDate.holidays;
final resultStr = myanmarDate.formatByPatternAndLanguage(
pattern: MyanmarDateFormat.simple,
langCatalog: mmCalendar.languageCatalog,
);
// Output: แแฌแแแฌแแพแ
แบ แแ
แแ แแฏ, แแผแแบแแฌแแพแ
แบ แแแแ
แแฏ, แแฎแแแบแธแแปแฝแแบ แแแผแแบแท แแแบ แแแแบแนแแแฝแฑแแฑแท
// (or)
final resultStr = myanmarDate.formatByPatternAndLanguage(
pattern: 'S s k, B y k, M p f r En',
langCatalog: 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 | แแฑแท |
Astrological Information #
final mmCalendar = MmCalendar(
config: MmCalendarConfig.myanmarLanguage(),
);
final myanmarDate = mmCalendar.fromDate(2023, 10, 19);
final astro = myanmarDate.astro;
// แกแแผแญแแนแแ
แฏแแบ
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