public void ToDateInterval() { var yearMonth = new YearMonth(2000, 1); var interval = new DateInterval(new LocalDate(2000, 1, 1), new LocalDate(2000, 1, 31)); Assert.AreEqual(interval, yearMonth.ToDateInterval()); }
public void ToDateInterval() { YearMonth yearMonth = new YearMonth(2019, 5); DateInterval interval = Snippet.For(yearMonth.ToDateInterval()); Assert.AreEqual(new LocalDate(2019, 5, 1), interval.Start); Assert.AreEqual(new LocalDate(2019, 5, 31), interval.End); }
protected override DateTime Wrap(YearMonth value) { if (_dayOfMonth > 28) { var lastDay = value.ToDateInterval().End.Day; if (lastDay < _dayOfMonth) { return(value.OnDayOfMonth(lastDay).ToDateTimeUnspecified()); } } return(value.OnDayOfMonth(_dayOfMonth).ToDateTimeUnspecified()); }
public async Task <AppointmentsForMonth> SearchAppointmentsByYearMonthAsync(YearMonth yearMonth) { var interval = yearMonth.ToDateInterval(); var aggregates = await _repository.SearchAsync(interval.Start, interval.End); var config = await _configManager.GetConfigAsync(); var response = new AppointmentsForMonth(yearMonth, config); foreach (var date in interval) { response.Appointments.Add(new AppointmentsForDay(date, config, aggregates.Where(a => a.From.Date == date).ToList())); } return(response); }
private void SetMonth(YearMonth month) { Month = month; PrevMonth = Month.ToDateInterval().Start.PlusDays(-1).ToYearMonth(); NextMonth = Month.ToDateInterval().End.PlusDays(1).ToYearMonth(); }