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

Implemented types

Constructors

Date()
const

Properties

day int
Day
no setter
formatter DateFormatter
create a formatter for this date object
no setter
hashCode int
hashcode operator
no setteroverride
hour int
Hour 0..23
no setter
julianDayNumber int
Julian day number
no setter
millisecond int
Milliseconds 0..999
no setter
minute int
Minute 0..59
no setter
month int
Month 1..12
no setter
monthLength int
Month length
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
second int
Second 0..59
no setter
time Duration
Returns the time part as Duration.
no setter
weekDay int
Week day number 1..7
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
compareTo(Date other) int
Compare dates
override
copy({int? year, int? month, int? day}) Date
Copy this date object with some fields changed
distanceFrom(Date other) int
distance between two dates
distanceTo(Date other) int
distance between two dates
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
toUtcDateTime() DateTime
Converts date to UTC DateTime object
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 <(Date other) bool
less than operator
operator <=(Date other) bool
less than or equal operator
operator ==(Object other) bool
equals operator
override
operator >(Date other) bool
bigger than operator
operator >=(Date other) bool
bigger than or equal operator
operator ^(Date other) int
distance between two dates

Constants

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