[ 
https://issues.apache.org/jira/browse/LANG-1637?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17257618#comment-17257618
 ] 

Michael Osipov commented on LANG-1637:
--------------------------------------

OK, this was a misunderstanding. Sorry for that. Here is the problem: {{Y}} 
denotes the ISO week year, not necessary the current year. 
{{TwoDigitYearField.INSTANCE}} is passed to to {{WeekYear}} ctor. It calls the 
former rule with {{calendar.getWeekYear()}}.  The problem is that 
{{TwoDigitYearField#appendTo(Appendable, int)}} expects a value between 0 and 
99 because it uses {{##appendDigits()}} which operates on two-digit numbers 
only. Everything else is undefined. Since it is an internal method it expects 
the input to be always valid.

> FastDatePrinter formatting using YY pattern yields junk digits
> --------------------------------------------------------------
>
>                 Key: LANG-1637
>                 URL: https://issues.apache.org/jira/browse/LANG-1637
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 3.11
>            Reporter: Uri Gonen
>            Priority: Minor
>          Time Spent: 3h 10m
>  Remaining Estimate: 0h
>
> {code:java}
> final GregorianCalendar cal = new GregorianCalendar(2020, 12, 31, 0, 0, 0);  
> final DatePrinter printer2Digits = getInstance("YY"); 
> assertEquals("21", printer2Digits.format(cal));
> {code}
> the above test fails



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to