Gregorian class

Gregorian date class

Implemented types

Constructors

Gregorian(int year, [int month = 1, int day = 1])
Create a Gregorian date by using year, month and day year and month default to 1 year, month and day can not be null [...]
Gregorian.fromDateTime(DateTime dateTime)
Create a Gregorian date by using DateTime object [...]
factory
Gregorian.fromJalali(Jalali date)
Create a Gregorian date from Jalali date [...]
factory
Gregorian.fromJulianDayNumber(int julianDayNumber)
Calculates Gregorian and Julian calendar dates from the Julian Day number julianDayNumber for the period since jdn=-34839655 (i.e. the year -100100 of both calendars) to some millions years ahead of the present. [...]
factory
Gregorian.now()
Get Gregorian date for now [...]
factory

Properties

day int
Gregorian day of the month (1 to 28/29/30/31) [...]
final
formatter GregorianFormatter
Formatter for this date object [...]
read-only, override
hashCode int
hashcode operator [...]
read-only, override
julianDayNumber int
Calculates the Julian Day number from Gregorian or Julian calendar dates. This integer number corresponds to the noon of the date (i.e. 12 hours of Universal Time). [...]
read-only, override
month int
Gregorian month (1 to 12) [...]
final
monthLength int
Computes number of days in a given month in a Gregorian year. [...]
read-only, override
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
weekDay int
Week day number monday = 1 sunday = 7 [...]
read-only, override
year int
Gregorian year (years BC numbered 0, -1, -2, ...) [...]
final

Methods

add({int years: 0, int months: 0, int days: 0}) Gregorian
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 [...]
addDays(int days) Gregorian
add days to this date this Method is safe [...]
addMonths(int months) Gregorian
add months to this date this Method is safe for month and year bounds [...]
addYears(int years) Gregorian
add years to this date [...]
compareTo(Gregorian other) int
Compare dates [...]
override
copy({int year, int month, int day}) Gregorian
Copy this date object with some fields changed [...]
isLeapYear() bool
Checks if a year is a leap year or not. [...]
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toDateTime() DateTime
Converts Gregorian date to DateTime object [...]
toJalali() Jalali
Converts a Gregorian date to Jalali. [...]
toString() String
Default string representation: Gregorian(YYYY,MM,DD). use formatter for custom formatting. [...]
override
withDay(int day) Gregorian
changes day [...]
withMonth(int month) Gregorian
changes month [...]
withYear(int year) Gregorian
changes year [...]

Operators

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

Static Properties

MAX Gregorian
Maximum computable Gregorian date [...]
final
MIN Gregorian
Minimum computable Gregorian date [...]
final