We're updating the issue view to help you get more done. 

parsing date in Japanese Calendar fails for 02.12.1844 - 31.12.1871

Description

Hallo,

I am formatting a date of the interval [31.12.1871|02.12.2008,] with a Japanese Calendar. In this case 02.12.1845.
The result of the format is correct. The emperor is Koka.
Parsing this date results in the incorrect date 02.12.1945. The emperor is Showa.

Here the source i tested with:

1 2 3 4 5 6 7 8 java.text.DateFormat dateFormatGregorian = java.text.DateFormat.getDateTimeInstance(2, 2, Locale.GERMAN); String sDate = "02.12.1845 12:34:56"; java.util.Date date = dateFormatGregorian.parse(sDate, new ParsePosition(0)); com.ibm.icu.util.Calendar cal = new com.ibm.icu.util.JapaneseCalendar(); com.ibm.icu.text.DateFormat df = cal.getDateTimeFormat( 2, 2, Locale.JAPANESE); String format = df.format(date); java.util.Date dateAfterParse = df.parse(format, new ParsePosition(0)); String formatAfterParse = df.format(dateAfterParse);

Results:

1 2 format = "弘化02/12/02 12:34:56" formatAfterParse = "昭和20/12/02 12:34:56"

This seems to have something to do with the japanese Symbols for the emperors, which are mixed up internally.
Doing the same with German Locale leads to the correct result: format.equals(formatAfterParse).
It also works for dates outside the mentioned interval.

Best regards
Christian

Environment

Status

Assignee

TracBot

Reporter

TracBot

tracCreated

Feb 11, 2009, 4:49 PM

tracOwner

jspieth

tracProject

ICU4J

tracReporter

christian.lutter@2d7994f13a65ef7b

tracStatus

accepted

Components

Priority

assess