Appends the reduced value of a date-time field to the formatter.
!(p)
This is typically used for formatting and parsing a two digit year.
!(p)
The base date is used to calculate the full value during parsing.
For example, if the base date is 1950-01-01 then parsed values for
a two digit year parse will be _in the range 1950-01-01 to 2049-12-31.
Only the year would be extracted from the date, thus a base date of
1950-08-25 would also parse to the range 1950-01-01 to 2049-12-31.
This behavior is necessary to support fields such as week-based-year
or other calendar systems where the parsed value does not align with
standard ISO years.
!(p)
The exact behavior is as follows. Parse the full set of fields and
determine the effective chronology using the last chronology if
it appears more than once. Then convert the base date to the
effective chronology. Then extract the specified field from the
chronology-specific base date and use it to determine the
{@code baseValue} used below.
!(p)
For formatting, the {@code width} and {@code maxWidth} are used to
determine the number of characters to format.
If they are equal then the format is fixed width.
If the value of the field is within the range of the {@code baseValue} using
{@code width} characters then the reduced value is formatted otherwise the value is
truncated to fit {@code maxWidth}.
The rightmost characters are output to match the width, left padding with zero.
!(p)
For strict parsing, the number of characters allowed by {@code width} to {@code maxWidth} are parsed.
For lenient parsing, the number of characters must be at least 1 and less than 10.
If the number of digits parsed is equal to {@code width} and the value is positive,
the value of the field is computed to be the first number greater than
or equal to the {@code baseValue} with the same least significant characters,
otherwise the value parsed is the field value.
This allows a reduced value to be entered for values _in range of the baseValue
and width and absolute values can be entered for values outside the range.
!(p)
For example, a base value of {@code 1980} and a width of {@code 2} will have
valid values from {@code 1980} to {@code 2079}.
During parsing, the text {@code "12"} will result _in the value {@code 2012} as that
is the value within the range where the last two characters are "12".
By contrast, parsing the text {@code "1915"} will result _in the value {@code 1915}.
@param field the field to append, not null
@param width the field width of the printed and parsed field, from 1 to 10
@param maxWidth the maximum field width of the printed field, from 1 to 10
@param baseDate the base date used to calculate the base value for the range
of valid values _in the parsed chronology, not null
@return this, for chaining, not null
@throws IllegalArgumentException if the width or base value is invalid
Appends the reduced value of a date-time field to the formatter. !(p) This is typically used for formatting and parsing a two digit year. !(p) The base date is used to calculate the full value during parsing. For example, if the base date is 1950-01-01 then parsed values for a two digit year parse will be _in the range 1950-01-01 to 2049-12-31. Only the year would be extracted from the date, thus a base date of 1950-08-25 would also parse to the range 1950-01-01 to 2049-12-31. This behavior is necessary to support fields such as week-based-year or other calendar systems where the parsed value does not align with standard ISO years. !(p) The exact behavior is as follows. Parse the full set of fields and determine the effective chronology using the last chronology if it appears more than once. Then convert the base date to the effective chronology. Then extract the specified field from the chronology-specific base date and use it to determine the {@code baseValue} used below. !(p) For formatting, the {@code width} and {@code maxWidth} are used to determine the number of characters to format. If they are equal then the format is fixed width. If the value of the field is within the range of the {@code baseValue} using {@code width} characters then the reduced value is formatted otherwise the value is truncated to fit {@code maxWidth}. The rightmost characters are output to match the width, left padding with zero. !(p) For strict parsing, the number of characters allowed by {@code width} to {@code maxWidth} are parsed. For lenient parsing, the number of characters must be at least 1 and less than 10. If the number of digits parsed is equal to {@code width} and the value is positive, the value of the field is computed to be the first number greater than or equal to the {@code baseValue} with the same least significant characters, otherwise the value parsed is the field value. This allows a reduced value to be entered for values _in range of the baseValue and width and absolute values can be entered for values outside the range. !(p) For example, a base value of {@code 1980} and a width of {@code 2} will have valid values from {@code 1980} to {@code 2079}. During parsing, the text {@code "12"} will result _in the value {@code 2012} as that is the value within the range where the last two characters are "12". By contrast, parsing the text {@code "1915"} will result _in the value {@code 1915}.
@param field the field to append, not null @param width the field width of the printed and parsed field, from 1 to 10 @param maxWidth the maximum field width of the printed field, from 1 to 10 @param baseDate the base date used to calculate the base value for the range of valid values _in the parsed chronology, not null @return this, for chaining, not null @throws IllegalArgumentException if the width or base value is invalid