ethiopianToGregorian static method
Convert Ethiopian date to Gregorian date Input: year, month, day in Ethiopian calendar Returns: Map with 'year', 'month', 'day' keys for Gregorian date
Implementation
static Map<String, int> ethiopianToGregorian({
required int year,
required int month,
required int day,
}) {
try {
final ethiopianDate = EtDatetime(year: year, month: month, day: day);
// Use UTC to avoid timezone-related off-by-one errors
final gregorianDate = DateTime.fromMillisecondsSinceEpoch(
ethiopianDate.moment,
isUtc: true,
);
return {
'year': gregorianDate.year,
'month': gregorianDate.month,
'day': gregorianDate.day,
};
} catch (e) {
throw Exception('Invalid Ethiopian date: $e');
}
}