code: private static LocalDate create(int year, Month month, int dayOfMonth) {
          if (dayOfMonth > 28 && dayOfMonth > month.length(IsoChronology.INSTANCE.isLeapYear(year))) {
              if (dayOfMonth == 29) {
                  throw new DateTimeException("Invalid date 'February 29' as '" + year + "' is not a leap year");
              } else {
                  throw new DateTimeException("Invalid date '" + month.name() + " " + dayOfMonth + "'");
              }
          }
          return new LocalDate(year, month.getValue(), dayOfMonth);
      }
docs: Creates a local date from the year, month and day fields.
  
  @param year  the year to represent, validated from MIN_YEAR to MAX_YEAR
  @param month  the month-of-year to represent, validated not null
  @param dayOfMonth  the day-of-month to represent, validated from 1 to 31
  @return the local date, not null
  @throws DateTimeException if the day-of-month is invalid for the month-year