BadiDate constructor
BadiDate({})
Badi date
for now only for the years up to LAST_YEAR_SUPPORTED
Dates before the year 172 are calculated according to the Baha'i Calendar
used in western countries.
parameters:
day int in range 1-19
month int in range 0-19
year int
longitude and latitude double for sunset calculation
ayyamIHa bool
For Ayyam'i'Ha set month to 0 or leave it empty and set ayyamIHa to true
Implementation
BadiDate(
{required this.day,
this.month = 0,
required this.year,
bool ayyamIHa = false,
this.latitude,
this.longitude,
this.altitude}) {
if (day < 1 || day > 19) {
throw ArgumentError.value(day, 'day', 'Day must be in the range [1-19]');
}
if (month < 0 || month > 19) {
throw ArgumentError.value(
month, 'month', 'Month must be in the range [1-19]');
}
if (month != 0 && ayyamIHa) {
throw ArgumentError.value(
month, 'month', 'Please set month to 0 or leave it out for AyyamIHa');
}
if (year > LAST_YEAR_SUPPORTED) {
throw UnsupportedError(
'Years greater than $LAST_YEAR_SUPPORTED are not supported yet');
}
_monthIntern = month == 0
? 19
: month == 19
? 20
: month;
}