period library

Support for creating your own custom periods.

This package is used to create custom periods.

Implementing your own Period or PeriodGenerator is easy.

There are already some Period classes implemented in this package. Look for SecondPeriod, MinutePeriod, HourPeriod, DayPeriod, WeekPeriod, FortnightPeriod, MonthPeriod, TrimesterPeriod, SemesterPeriod and YearPeriod.

There are already some PeriodGenerator classes implemented in this package. Look for SecondGenerator, MinuteGenerator, HourGenerator, DayGenerator, WeekGenerator, FortnightGenerator, MonthGenerator, TrimesterGenerator, SemesterGenerator and YearGenerator.

Classes

DayGenerator
A class that implements a generator of a period type of a day.
DayPeriod
A class that implements a period type of a day.
DayPeriodBundle
A base class that represents a bundle of days.
Every
Abstract class that, when extended, processes DateTime with custom logic.
EveryDateValidator
A base class that represents an Every with a DateValidator.
EveryDateValidatorDifference<E extends EveryDateValidator>
Class that processes DateTime so that the next always returns the next day where only one of the EveryDateValidators conditions is met.
EveryDateValidatorIntersection<E extends EveryDateValidator>
Class that processes DateTime so that the next always returns the next day where all of the EveryDateValidators conditions are met.
EveryDateValidatorUnion<E extends EveryDateValidator>
Class that processes DateTime so that the next always returns the next day where any of the EveryDateValidators conditions are met.
EveryDayInYear
Class that processes DateTime so that the addYears always returns the next day where the difference in days between the date and the first day of the year is equal to the dayInYear.
EveryDueDayMonth
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.
EveryDueTimeOfDay
Class that processes DateTime so that next always returns the next day with the same hour, minute, second, millisecond and microsecond as the DateTime that is being processed.
EveryDueWorkdayMonth
Class that processes DateTime so that the addMonths always returns the next month's with the DateTime.day being the dueWorkday workday of the month clamped to fit in the length of the next month.
EveryModifier<T extends Every>
Abstract class that, when extended, processes DateTime with custom logic.
EveryModifierInvalidator<T extends Every>
Class that wraps an every generator and adds an invalidator that will be used to invalidate the generated dates.
EveryOverrideWrapper<T extends Every>
Class that wraps an Every generator and adds a DateValidator that will be used to invalidate the generated dates and an overrider that will be used instead.
EverySkipCountWrapper<T extends Every>
Class that wraps an Every generator and skips count times from the Every base process.
EverySkipInvalidModifier<T extends Every, V extends DateValidator>
Class that wraps an Every generator and adds a DateValidator that will be used to invalidate the generated dates.
EveryWeekday
Class that processes DateTime so that the addWeeks always returns the next week's with the DateTime.weekday equals to the weekday.
EveryWeekdayCountInMonth
Class that processes DateTime so that the addMonths always returns the next month's with the week occurrence of the day (DateTime.weekday is the day's Weekday.dateTimeValue).
FortnightGenerator
A class that implements a generator of a period type of a fortnight.
FortnightPeriod
A class that implements a period type of a fortnight.
HourGenerator
A class that implements a generator of a period type of an hour.
HourPeriod
A class that implements a period type of an hour.
LimitedEvery
Abstract class that forces the implementation of Every to have a limit parameter for the startDate, next and previous methods.
MinuteGenerator
A class that implements a generator of a period type of a minute.
MinutePeriod
A class that implements a period type of a minute.
MonthGenerator
A class that implements a generator of a period type of a month.
MonthPeriod
A class that implements a period type of a month.
MonthPeriodBundle
A base class that represents a bundle of months.
Period
A period of time between two DateTimes.
SecondGenerator
A class that implements a generator of a period type of a second.
SecondPeriod
A class that implements a period type of a second.
SemesterGenerator
A class that implements a generator of a period type of a semester.
SemesterPeriod
A class that implements a period type of a semester.
TrimesterGenerator
A class that implements a generator of a period type of a trimester.
TrimesterPeriod
A class that implements a period type of a trimester.
WeekGenerator
A class that implements a generator of a period type of a week.
WeekPeriod
A class that implements a period type of a week.
YearGenerator
A class that implements a generator of a period type of a year.
YearPeriod
A class that implements a period type of a year.

Enums

DateDirection
An enum that represents the direction of the process inside EveryModifier. Used on EveryModifier.processDate.
Month
Month constants that are returned by DateTime.month method.
PeriodGenerator<T extends Period>
An enumeration of the different period generators implemented in this package.
Week
Week occurrences inside a month.
Weekday
Weekday constants that are returned by DateTime.weekday method.
WorkdayDirection
An enum that represents the direction of the EveryDueWorkdayMonth.from constructor.

Mixins

EveryDateValidatorListMixin<E extends EveryDateValidator>
Mixin that represents a list of EveryDateValidator.
EveryModifierMixin<T extends Every>
Mixin that, when used, passes the calls the specific method on the underlying every.
EveryMonth
Processes DateTime with custom logic.
EveryWeek
Processes DateTime with custom logic.
EveryYear
Processes DateTime with custom logic.
LimitedEveryModifierMixin<T extends Every>
Mixin that, when used, passes the calls the specific method on the underlying every.
PeriodGeneratorMixin<T extends Period>
A mixin for generating period types.

Extensions

ExactTimeOfDay on DateTime
Extension on DateTime to get the exact time of the day.

Exceptions / Errors

DateTimeLimitReachedException
Exception thrown when a date limit is reached.