I need to parse dates in various formats. Some of these are missing the "day". Now I want to default to end of month. I am not sure if there is a direct way where we can default to end of month
DateTimeFormatter f = new DateTimeFormatterBuilder()
.appendPattern("MM.yyyy")
.parseDefaulting(DAY_OF_MONTH, 1) // can we default to end of month?
.toFormatter();
LocalDate.parse("11.2017", f)
But if not, how can I know that the original date was missing the day (or that a default was used) and therefore I need to adjust it manually by using LocalDate.parse("11.2017", f).with(TemporalAdjusters.lastDayOfMonth()).