mixin27 / flutter-mmcalendar

Myanmar calendar package for flutter application.
https://pub.dev/packages/flutter_mmcalendar
MIT License
3 stars 1 forks source link
burmese calendar calendar-converter converter flutter library mmcalendar myanmar myanmar-calendar package

Flutter MMCalendar

License: MIT Pub Version (including pre-releases)

Package to get Myanmar calendar information with Burmese Astrological Information, Holidays and Moon phase widget.

You can check Myanmar Calendar App using flutter_mmcalendar.

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

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:

Available languages:

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):

// S s k, B y k, M p f r En
MyanmarDateFormat.simple
// S
MyanmarDateFormat.sasanaYear
// s
MyanmarDateFormat.buddhistEra
// B
MyanmarDateFormat.burmeseYear
// y
MyanmarDateFormat.myanmarYear
// k
MyanmarDateFormat.ku
// M
MyanmarDateFormat.monthInYear
// p
MyanmarDateFormat.moonPhase
// f
MyanmarDateFormat.fortnightDay
// E
MyanmarDateFormat.dayNameInWeek
// n
MyanmarDateFormat.nay
// r
MyanmarDateFormat.yat
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;

Moon Phase Widget

MoonPhaseWidget(
  date: DateTime.now(),
  size: 50,
),

Concept reference resources

Algorithm, Program and Calculation of Myanmar Calendar

C++ and Javascript Implementation

Java Library Implementation