Is there a way do write a DateTimeFormatter pattern that parser "either" one of two optional parts? Something like (MMMM-d-(yy OR yyyy))?
For an example:
val formatter = DateTimeFormatter.ofPattern("MMMM-d-[yyyy][yy]");
System.out.println(formatter.parse("June-27-2022")); // {},ISO resolved to 2022-06-27
System.out.println(formatter.parse("June-27-22")); // {},ISO resolved to 2022-06-27
System.out.println(formatter.parse("June-27-")); // {MonthOfYear=6, DayOfMonth=27},ISO
I want to parse either the short (yy) or long (yyyy) year format. The problem with my pattern is that the last example gets parsed without either of these optional parts of the pattern defined.