YearMonth class

Create an object that only contains year and month only

Implemented types

Constructors

YearMonth(int year, int month)
Create new YearMonth's year and month with valid value
const
YearMonth.dateTime(DateTime dateTime)
Inspect DateTime object and convert back to YearMonth
factory
YearMonth.now()
Get current year and month from DateTime.now
factory

Properties

allDaysInMonth Set<DateTime>
Generate a Set of DateTime which is from YearMonth
no setter
firstDay DateTime
Get first day of YearMonth and convert back to YearMonth
no setter
hashCode int
Hash code from Obejct.hashCode, but not design for using ==.
no setteroverride
lastDay DateTime
Get last day of YearMonth and convert back to YearMonth
no setter
month int
Month between 1 to 12
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
todayInThisMonth bool
Check today is contains in this month from YearMonth.now
no setter
year int
Year which follow ISO 8601 standard of the year format
final

Methods

compareTo(YearMonth other) int
Implemented from Comparable which equal 0 means this and other are the same, greater than 0 means other is greater and lesser than 0 means other is lesser
override
formatString({String format = "MMMM, yyyy", String? locale}) String
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator <(Object compare) bool
Compare this YearMonth is lesser than compare
operator <=(Object compare) bool
Combine operator of == and <
operator ==(Object compare) bool
Compare this YearMonth and compare the same
override
operator >(Object compare) bool
Compare this YearMonth is greater than compare
operator >=(Object compare) bool
Combine operator of == and >