Skip to content

Conversation

@SL-TX
Copy link
Owner

@SL-TX SL-TX commented Dec 17, 2022

Базовый уровень

var dateIs = LocalDate.parse(date, DateTimeFormatter.ofPattern("dd-MM-yyyy"));
switch (taskPeriod) {
case ONE_OFF -> {
return this.dateTime.toLocalDate() == dateIs;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Сравнение я бы сделал через equals все же

return this.dateTime.toLocalDate() == dateIs;
}
case DAILY -> {
return this.dateTime.toLocalDate().datesUntil(dateIs.plusDays(1)).anyMatch(t->t.equals(dateIs));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Можно просто сравнить даты, а не высчитывать их стримом
Например ежедневная задача и так будет повторятся каждый день поэтому надо сравнить что дата задачи просто раньше чем переданная дата
такие же правила - можно вывести для каждого типа повторяемости если немного подумать как даты могут быть связаны

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants