getDayFromTibetan static method
GET DAY FROM TIBETAN
Implementation
static TibetanCalendar getDayFromTibetan(Map<String, dynamic> _a) {
var year = _a['year'],
month = _a['month'],
_b = _a['isLeapMonth'],
//todo checek leap
isLeapMonth = _b == null ? false : _b,
day = _a['day'],
_c = _a['isLeapDay'],
//todo checek leap
isLeapDay = _c == null ? false : _c;
var julianDate = julianFromTibetan(year, month, isLeapMonth, day);
/// also calculate the Julian date of the previous Tib. day
var monthCount = monthCountFromTibetan({
'year': year,
'month': month,
'isLeapMonth': isLeapMonth,
});
var dayBefore = getDayBefore(day, monthCount);
var julianDatePrevious =
(trueDateFromMonthCountDay(dayBefore['day'], dayBefore['monthCount']))
.floor();
// var twoDaysBefore = getDayBefore(dayBefore['day'], dayBefore['monthCount']);
// var julianDate2DaysBefore = (trueDateFromMonthCountDay(
// twoDaysBefore['day'], twoDaysBefore['monthCount']))
// .floor();
/// figure out leap months, leap days & skipped days
// var isDoubledMonthThis = isDoubledMonth(year, month);
var hasLeapDayThis = julianDate == julianDatePrevious + 2;
// var skippedDay = julianDate == julianDatePrevious;
// var isPreviousSkipped = julianDatePrevious == julianDate2DaysBefore;
var isLeapDayChecked = isLeapDay && hasLeapDayThis;
/// figure out western date info for the main or leap day
if (isLeapDayChecked) {
julianDate--;
}
//get nixdate from julian
//var westernDate = unixFromJulian(julianDate);
return TibetanCalendar(
year: year,
month: month,
day: day,
isLeapDay: isLeapDayChecked,
isLeapMonth: isLeapMonth);
/*return {
'year': year,
'month': {
'month': month,
'isLeapMonth': isLeapMonth && isDoubledMonthThis,
'isDoubledMonth': isDoubledMonthThis,
},
'day': day,
'skippedDay': skippedDay,
'isPreviousSkipped': isPreviousSkipped,
'isLeapDay': isLeapDayChecked,
'isDoubledDay': hasLeapDayThis,
'westernDate': 'westernDate',
};*/
}