Month class

A convenient class to work with only IsoWeek

Constructors

Month({required int year, int month = 1})
Constructs the Month object
const
Month.fromDate(Date date)
Create Month from Date
factory
Month.fromDateTime(DateTime datetime)
////////////////////////////////// FACTORIES Create Month from DateTime
factory
Month.lastMonth()
Get last month
factory
Month.nextMonth()
Get next month
factory
Month.now()
Get the current Month
factory
Month.thisMonth()
Same as Month.now
factory

Properties

dates Map<int, Date>
Returns the dates of the month
no setter
endOfMonth Date
Return the Date at the end of month
no setter
getMONTH MONTH
Get the enum value of month
no setter
hashCode int
The hash code for this object.
no setteroverride
isLastMonth bool
Return true if month is last month
no setter
isNextMonth bool
Return true if month is next month
no setter
isThisMonth bool
Return true if month is this month
no setter
month int
A number that represent month
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
startOfMonth Date
Return the Date at the start of month
no setter
year int
A number that represent year
final

Methods

add(Duration duration) Month
////////////////////////////////// OPERATIONS Add a Duration to this month
addDays(int amount) Month
Add weeks
addMonths(int amount) Month
Add a certain amount of months to this week
addQuarters(int amount) Month
Add a certain amount of quarters to this week
addWeeks(int amount) Month
Add a certain amount of weeks to this week
addYears(int amount) Month
Add a certain amount of years to this week
copyWith({int? year, int? month}) Month
////////////////////////////////// SETTERS Create a new copy with updated values
format([String? pattern, String? locale]) String
Short-hand to DateFormat
isAfter(Month other) bool
////////////////////////////////// COMPARISON Return true if month is after other, false otherwise.
isBefore(Month other) bool
Return true if month is before other, false otherwise.
isSameOrAfter(Month other) bool
Return true if other isEqual or isAfter to this date
isSameOrBefore(Month other) bool
Return true if other isEqual or isBefore to this date
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setMonth(int month) Month
Set the month by number
setMONTH(MONTH month) Month
Set the month by enum value
setYear(int year) Month
Set the year
subDays(int amount) Month
Subtracts an amount of days from this week
subMonths(int amount) Month
Subtracts an amount of months from this week
subQuarters(int amount) Month
Add a certain amount of quarters to this week
subtract(Duration duration) Month
Subtract a Duration to this month
subWeeks(int amount) Month
Subtracts an amount of months from this week
subYears(int amount) Month
Subtracts an amount of years from this Date
toKey() String
////////////////////////////////// KEY Convert Month to a unique id
toString() String
A string representation of this object.
override

Operators

operator <(Month other) bool
Less than operator
operator <=(Month other) bool
Less than or equals to operator
operator ==(Object other) bool
////////////////////////////////// OBJECT OVERRIDES
override
operator >(Month other) bool
Greater than operator
operator >=(Month other) bool
Greater or equals to operator
operator [](int day) Date
Convenient operator to get the date

Static Methods

fromKey(String key) Month?
Convert a unique id to Month
parse(String dateStr, {String? format, bool utc = false}) Month
////////////////////////////////// FORMAT Constructs a new DateTime instance based on dateStr.
tryParse(String dateStr, {String? format, bool utc = false}) Month?
Constructs a new DateTime instance based on dateStr.

Constants

endOfTime → const Month
Const value to signify the end of time that can be used as a default value
epoch → const Month
Const value for the first month of epoch that can be used as a default value
startOfTime → const Month
Const value for the first month in year 1 that can be used as a default value