Flutter MMCalendar

License: MIT Pub Version (including pre-releases)

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

C++ and Javascript Implementation

Java Library Implementation

Libraries

flutter_mmcalendar
Myanmar calendar library for flutter application with many utility methods and calculations.