of method
- DateTime date
override
Returns the period of the given date
considering the generator type.
Implementation
@override
SemesterPeriod of(DateTime date) {
final julyFirst = date.copyWith(month: DateTime.july, day: 1).date;
if (date.isBefore(julyFirst)) {
return SemesterPeriod(
start: date.firstDayOfYear.date,
end: julyFirst.subtract(const Duration(microseconds: 1)),
);
}
return SemesterPeriod(
start: julyFirst,
end: date.lastDayOfYear.endOfDay,
);
}