From DateTimeFormatter javadoc:
If the count of letters is less than four (but not two), then the sign is only output for negative years as per SignStyle.NORMAL. Otherwise, the sign is output if the pad width is exceeded, as per SignStyle.EXCEEDS_PAD.
From what I understand, if the pad width is not exceeded and the count of letters is four, the minus sign (for negative years) should not be printed during formatting.
So I wrote such a snippet of code (figuring that I cannot use 'y' because then the year will always be positive):
var negativeDate = LocalDate.now().minus(2021, ChronoUnit.YEARS);
var formatter = DateTimeFormatter.ofPattern("ppppuuuu");
var text = negativeDate.format(formatter);
System.out.println("formatted string: " + text);
This code throws DateTimeException: "Cannot print as output of 5 characters exceeds pad width of 4".
So my question is basically how to see this last sentence from the javadoc work.