EveryDueDayMonth class
Class that processes DateTime so that the addMonths always returns the next month's with the DateTime.day as the dueDay clamped to fit in the length of the next month.
E.g.
- If the dueDay is 31 and the next month end at 28, the addMonths will return the next month with the DateTime.day as 28.
- If the dueDay is 31 and the next month end at 31, the addMonths will return the next month with the DateTime.day as 31.
- If the dueDay is 15, the addMonths will return the next month with the DateTime.day as 15.
- Inheritance
-
- Object
- DateValidator
- ExactDateValidator
- DateValidatorDueDayMonth
- EveryDueDayMonth
- Implemented types
- Mixed-in types
Constructors
- EveryDueDayMonth(int dueDay)
-
Returns a EveryDueDayMonth with the given
dueDay
. When you call next or previous on this EveryDueDayMonth, it will return thedueDay
of the next or previous month.const - EveryDueDayMonth.from(DateTime date)
-
Returns a EveryDueDayMonth with the dueDay being the DateTime.day of
the given
date
. When you call next or previous on this EveryDueDayMonth, it will return the dueDay of the next or previous month.factory
Properties
- dueDay → int
-
The expected day of the month.
finalinherited
- exact → bool
-
If true, the day of the month must be exactly this dueDay.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- inexact → bool
-
Returns whether the DateTime passed to valid or invalid can be
inexact.
no setterinherited
-
props
→ List<
Object> -
The list of properties that will be used to determine whether
two instances are equal.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stringify → bool?
-
If set to
true
, the toString method will be overridden to output this instance's props.no setterinherited
Methods
-
addMonths(
DateTime date, int months) → DateTime -
Returns the
date
- DateTime.month +months
with the DateTime.day as the dueDay, clamped to the months length.override -
addYears(
DateTime date, int years) → DateTime -
This mixin's implementation of Every.next and Every.previous.
inherited
-
compareTo(
DateValidatorDueDayMonth other) → int -
Compares this object to another object.
inherited
-
filterValidDates(
Iterable< DateTime> dates) → Iterable<DateTime> -
Returns the valid dates for this DateValidator in
dates
.inherited -
invalid(
DateTime date) → bool -
Returns true if the
date
is invalid for this DateValidator.inherited -
next(
DateTime date) → DateTime -
Returns the next month of the given
date
considering this EveryMonth implementation.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
previous(
DateTime date) → DateTime -
Returns the previous month of the given
date
considering this EveryMonth implementation.inherited -
startDate(
DateTime date) → DateTime -
Returns the next date that fits the dueDay.
override
-
toString(
) → String -
A string representation of this object.
override
-
valid(
DateTime date) → bool -
Returns true if the
date
is valid for this DateValidator.inherited -
validsIn(
Iterable< DateTime> dates) → Iterable<DateTime> -
Returns the valid dates for this DateValidator in
dates
.inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited