fetchMonthEvents method
Future<void>
fetchMonthEvents(
)
Implementation
Future<void> fetchMonthEvents() async {
periodEvents = [];
var startWeekDate =
DateTime(currentYear, currentMonth).add(const Duration(days: 0));
var startDayDate =
startWeekDate.subtract(Duration(days: startWeekDate.weekday - 1));
var endWeekDate =
DateTime(currentYear, currentMonth).add(const Duration(days: 7 * 5));
var endDayDate =
endWeekDate.subtract(Duration(days: endWeekDate.weekday - 7));
endDayDate =
DateTime(endDayDate.year, endDayDate.month, endDayDate.day, 23, 59);
periodEvents = await widget.eventProvider
.fetchEvents(context, startDayDate, endDayDate);
setState(() {});
}