code: protected int[] parseDate(CharSequenceScanner scanner) {
  
      int year = 0;
      int month = -1;
      int day = -1;
      // proceed date
      try {
        String yearString = scanner.readWhile(CharFilter.LATIN_DIGIT_FILTER);
        if (yearString.length() == 8) {
          // "yyyyMMdd".length() == 8
          year = Integer.parseInt(yearString.substring(0, 4));
          month = Integer.parseInt(yearString.substring(4, 6));
          day = Integer.parseInt(yearString.substring(6, 8));
        } else {
          char c = scanner.forceNext();
          if (c == '-') {
            year = Integer.parseInt(yearString);
            String monthString = scanner.readWhile(CharFilter.LATIN_DIGIT_FILTER);
            if (monthString.length() == 2) {
              month = Integer.parseInt(monthString);
              c = scanner.forceNext();
              if (c == '-') {
                String dayString = scanner.readWhile(CharFilter.LATIN_DIGIT_FILTER);
                if (dayString.length() == 2) {
                  day = Integer.parseInt(dayString);
                }
              }
            }
          }
        }
        if (((month < 1) || (month > MAX_MONTH)) || ((day < 1) || (day > MAX_DAY_OF_MONTH))) {
          throw new IllegalDateFormatException(scanner.getOriginalString());
        }
        return new int[] { year, month, day };
      } catch (Exception e) {
        throw new IllegalDateFormatException(scanner.getOriginalString(), e);
      }
    }
docs: This method parses the date from the given {@code scanner}. The format is {@code yyyy[-]MM[-]dd}.
  
  @param scanner is the parser pointing to the date.
  @return an array containing the year, month, and day in that order.