Просмотр данных показывает встречи по неделям, даже если я отмечаю переключатель с месяцем
Dictionary<int, Hashtable> parsedAppointments = new Dictionary<int, Hashtable>();
// Adjusts appointments that will end up in calendar based on if the Week or Month view is chosen.
foreach (var appointment in appointments)
{
DateTime startTime = DateTime.Parse(appointment.Value["start"].ToString());
DateTime endTime = DateTime.Parse(appointment.Value["end"].ToString());
DateTime today = DateTime.UtcNow;
if (weekView)
{
DateTime sunday = today.AddDays(-(int)today.DayOfWeek);
DateTime saturday = today.AddDays(-(int)today.DayOfWeek + (int)DayOfWeek.Saturday);
if (startTime >= sunday && endTime < saturday)
{
// only include the apps that get here
parsedAppointments.Add(appointment.Key, appointment.Value);
}
}
else
{
DateTime firstDayOfMonth = new DateTime(today.Year, today.Month, 1);
DateTime lastDayOfMonth = firstDayOfMonth.AddMonths(1).AddDays(-1);
if (startTime >= firstDayOfMonth && endTime < lastDayOfMonth)
{
// only include apps that get here
parsedAppointments.Add(appointment.Key, appointment.Value);
}
}
}