Доброго дня, коллега.
решил этот пункт двумя способами,
подскажи, что не хватает валидатору?
package com.javarush.task.task40.task4012;
import java.time.*;
import java.time.temporal.ChronoUnit;
/*
Полезные методы DateTime API
*/
public class Solution {
public static void main(String[] args) {
System.out.println(isLeap(LocalDate.now().minusYears(3)));
}
public static boolean isLeap(LocalDate date) {
return date.lengthOfYear() == 366;
// return Year.parse(((Integer) date.getYear()).toString()).isLeap();
}
public static boolean isBefore(LocalDateTime dateTime) {
LocalDateTime localDateTimeNow = LocalDateTime.now();
return dateTime.isBefore(localDateTimeNow);
}
public static LocalTime addTime(LocalTime time, int n, ChronoUnit chronoUnit) {
return time.plus(n, chronoUnit);
}
public static Period getPeriodBetween(LocalDate firstDate, LocalDate secondDate) {
if (firstDate.isBefore(secondDate))
return Period.between(firstDate, secondDate);
else return Period.between(secondDate, firstDate);
}
}