PersianDate constructor

PersianDate(
  1. int year,
  2. int month,
  3. int day
)

Creates a date from a Jalali year, month, and day.

Throws ArgumentError when month is outside 1 to 12, day is outside the length of that month, or the date is outside the supported range.

Implementation

PersianDate(this.year, this.month, this.day) : _dateTime = null {
  if (year < -61 || year > 3177) {
    throw ArgumentError.value(year, 'year', 'Must be in -61 to 3177');
  }
  if (month < 1 || month > 12) {
    throw ArgumentError.value(month, 'month', 'Must be in 1 to 12');
  }
  final length = jalaliMonthLength(year, month);
  if (day < 1 || day > length) {
    throw ArgumentError.value(day, 'day', 'Must be in 1 to $length');
  }
  _checkRange(j2d(year, month, day));
}