Jalali class

Jalali (Shamsi or Persian) Date class

Implemented types
Available extensions

Constructors

Jalali(int year, [int month = 1, int day = 1, int hour = 0, int minute = 0, int second = 0])
Create a Jalali date by using year, month and day year and month default to 1 year, month and day can not be null
Jalali.fromDateTime(DateTime dateTime)
Create a Jalali date by using DateTime object
factory
Jalali.fromGregorian(Gregorian date)
Create a Jalali date from Gregorian date
factory
Jalali.fromJulianDayNumber(int julianDayNumber)
Converts the Julian Day number to a date in the Jalali calendar.
factory
Jalali.now()
Get Jalali date for now
factory

Properties

day int
Jalali day (1 to 29/31)
final
formatter JalaliFormatter
Formatter for this date object
no setteroverride
hashCode int
hashCode operator
no setteroverride
hour int
Jalali hour (0 to 23)
final
julianDayNumber int
Converts a date of the Jalali calendar to the Julian Day number.
no setteroverride
minute int
Jalali minute (0 to 59)
final
month int
Jalali month (1 to 12)
final
monthLength int
Computes number of days in a given month in a Jalali year.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
second int
Jalali second (0 to 59)
final
weekDay int
Week day number Shanbe = 1 Jomee = 7
no setteroverride
year int
Jalali year (1 to 3100)
final

Methods

add({int years = 0, int months = 0, int days = 0, int hours = 0, int minutes = 0, int seconds = 0}) Jalali
add days, months and years separately note: it does not make any conversion, it simply adds to each field value for subtracting simple add negative value
override
addDays(int days) Jalali
add days to this date this Method is safe
override
addMonths(int months) Jalali
add months to this date this Method is safe for month and year bounds
override
addYears(int years) Jalali
add years to this date
override
compareTo(Jalali other) int
Compare dates
override
copy({int? year, int? month, int? day, int? hour, int? minute, int? second}) Jalali
Copy this date object with some fields changed
override
isLeapYear() bool
Checks if a year is a leap year or not.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDateTime() DateTime
Converts Jalali date to DateTime object
override
toGregorian() Gregorian
Converts a Jalali date to Gregorian.
toString() String
Default string representation: Jalali(YYYY,MM,DD). use formatter for custom formatting.
override
withDay(int day) Jalali
changes day
override
withMonth(int month) Jalali
changes month
override
withYear(int year) Jalali
changes year throws if year is null
override

Operators

operator +(int days) Jalali
add days this Method is safe
override
operator -(int days) Jalali
subtract days this Method is safe
override
operator <(Jalali other) bool
less than operator
operator <=(Jalali other) bool
less than or equal operator
operator ==(Object other) bool
equals operator
override
operator >(Jalali other) bool
bigger than operator
operator >=(Jalali other) bool
bigger than or equal operator

Static Properties

MAX Jalali
Maximum computable Jalali date
final
MIN Jalali
Minimum computable Jalali date
final