HijriDate class

A day of the lunar Hijri (Islamic) calendar as Iran's official calendar counts it.

Create one from Hijri values with HijriDate.new, or convert with HijriDate.fromPersianDate, HijriDate.fromDateTime, PersianDate.toHijri(), or DateTime.toHijriDate(). All of them use IranianHijri.official; use an IranianHijri with announced month starts when the calculation is a day off.

Supports the Hijri dates of PersianDate.min to PersianDate.max, HijriDate.min to HijriDate.max.

Implemented types

Constructors

HijriDate(int year, int month, int day)
Creates a date from a Hijri year, month, and day on IranianHijri.official.
factory
HijriDate.fromDateTime(DateTime dateTime)
The Hijri date of the calendar day of dateTime on IranianHijri.official; the time of day is ignored.
factory
HijriDate.fromPersianDate(PersianDate date)
The Hijri date of date on IranianHijri.official; the time of day is ignored.
factory

Properties

day → int
Day of the month, 1 to monthLength.
final
hashCode → int
The hash code for this object.
no setteroverride
month → int
Month, 1 (Muharram) to 12 (Dhu al-Hijjah).
final
monthLength → int
Number of days in month of year, 29 or 30, on IranianHijri.official.
no setter
monthName → String
Persian name of month, for example محرم for month 1.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
weekday → int
ISO weekday, 1 = Monday to 7 = Sunday, the same as PersianDate.weekday.
no setter
weekdayName → String
Persian name of weekday, for example جمعه for Friday.
no setter
weekdayNameShort → String
One-letter Persian name of weekday, for example ج for Friday.
no setter
year → int
Hijri year, for example 1447. Years before the Hijra are 0 or negative.
final

Methods

compareTo(HijriDate other) → int
Orders dates by year, then month, then day.
override
format(String pattern, {bool persianDigits = false}) → String
Formats this date with pattern.
isAfter(HijriDate other) → bool
Whether this date is after other.
isBefore(HijriDate other) → bool
Whether this date is before other.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDateTime() → DateTime
Local midnight of the same day.
toPersianDate() → PersianDate
The same day on the Jalali calendar, date-only.
toString() → String
day monthName year, for example 1 شوال 1447.
override

Operators

operator <(HijriDate other) → bool
Whether this date is before other; see compareTo.
operator <=(HijriDate other) → bool
Whether this date is before or the same day as other.
operator ==(Object other) → bool
Equal when year, month, and day match.
override
operator >(HijriDate other) → bool
Whether this date is after other; see compareTo.
operator >=(HijriDate other) → bool
Whether this date is after or the same day as other.

Static Properties

max → HijriDate
Last supported date, the Hijri date of PersianDate.max.
final
min → HijriDate
First supported date, the Hijri date of PersianDate.min.
final

Constants

monthNames → const List<String>
Persian names of the Hijri months, as the Iranian calendar writes them, from Muharram to Dhu al-Hijjah.