MenoData / Time4J

Advanced date, time and interval library for Java with sun/moon-astronomy and calendars like Chinese, Coptic, Ethiopian, French Republican, Hebrew, Hijri, Historic Christian, Indian National, Japanese, Julian, Korean, Minguo, Persian, Thai, Vietnamese
GNU Lesser General Public License v2.1
424 stars 62 forks source link

Support for Chinese numerals #955

Closed MenoData closed 2 years ago

MenoData commented 2 years ago

The enum NumberSystem should be enhanced with Chinese numerals, one for decimal representations (used mainly for year numbers) and one arithmetic variant similar to Japanese. However, when parsing, both variants should have the same capabilities to understand all possible representations (decimal and arithmetic).

See also: https://en.wikipedia.org/wiki/Chinese_numerals

MenoData commented 2 years ago

An additional fix and change to the Chinese decimal system is needed. There is also an alternative zero character so we have 11 instead of 10 valid digit characters. Second, the code points of decimal digits are not mapped to range 0-9 in step widths of 1. The consequence is: The Chinese decimal system cannot be handled as technical decimal system.

MenoData commented 2 years ago

The Chinese decimal system is tricky. A new method hasDecimalCodepoints() is necessary. It will yield false for that system in order to properly format numbers but the method isDecimal() will yield true to enable padding with zero characters.