Date class abstract

Super class of Jalali and Georgian classes

Date objects are required to be immutable

Dates should be uniquely specified by year, month and day Or by using julian day number

Date objects are valid dates once constructed, It should throw exception when there is a validity or calculation problem

For example constructing date with day being out of month length or date being out of computable region throws DateException

Implementers

Constructors

Date()

Properties

day int
Day
no setter
formatter DateFormatter
create a formatter for this date object
no setter
hashCode int
Subclasses should implement hashcode operator
no setteroverride
hour int
Hour
no setter
julianDayNumber int
Julian day number
no setter
minute int
Minute
no setter
month int
Month
no setter
monthLength int
Month length
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
second int
Second
no setter
weekDay int
Week day number
no setter
year int
Year
no setter

Methods

add({int years = 0, int months = 0, int days = 0}) Date
makes a new date instance and add days, months and years separately
addDays(int days) Date
makes a new date object with added days to this date
addMonths(int months) Date
Makes a new date object with added months to this date
addYears(int years) Date
Makes a new date object with added years to this date
copy({int? year, int? month, int? day}) Date
Copy this date object with some fields changed
isLeapYear() bool
Checks if a year is a leap year or not
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDateTime() DateTime
Converts date to DateTime object
toString() String
Subclasses should implement toString
override
withDay(int day) Date
Make a new date object with changed day
withMonth(int month) Date
Make a new date object with changed month
withYear(int year) Date
Make a new date object with changed year

Operators

operator +(int days) Date
Add days
operator -(int days) Date
Subtract days
operator ==(Object other) bool
Subclasses should implement equals operator
override

Constants

maxJulianDayNumber → const int
Maximum computable julian day number
minJulianDayNumber → const int
Minimum computable julian day number