of method
- DateTime date
override
Returns the period of the given date
considering the generator type.
Implementation
@override
WeekPeriod of(DateTime date) {
var difference = weekStart - date.weekday;
if (difference > 0) difference -= DateTime.daysPerWeek;
final day = date.day + difference;
final start = date.copyWith(day: day).date;
final end = start.addDays(DateTime.daysPerWeek - 1).endOfDay;
return WeekPeriod(start: start, end: end);
}