Skip to content

"B" symbol in pattern of dayperiod is not supported #866

@jun66j5

Description

@jun66j5

Overview Description

(Originally reported in https://trac.edgewall.org/ticket/13482, running unit tests in Trac with Babel 2.10.1)

Since Babel 2.10.0 (CLDR 41), B symbol is used in datetime pattern for zh_Hant locale, however Babel doesn't support the B symbol.

Steps to Reproduce

>>> from datetime import datetime
>>> import pytz
>>> import babel
>>> from babel import dates
>>> babel.__version__
'2.10.1'
>>> dates.get_time_format('medium', 'zh_Hant')
<DateTimePattern 'Bh:mm:ss'>
>>> t1 = datetime(2010, 8, 28, 1, 45, 56, 0, pytz.UTC)
>>> t2 = datetime(2010, 8, 28, 13, 45, 56, 0, pytz.UTC)
>>> s1 = dates.format_datetime(t1, 'medium', t1.tzinfo, 'zh_Hant')
>>> s1
'2010年8月28日 B1:45:56'
>>> s2 = dates.format_datetime(t2, 'medium', t1.tzinfo, 'zh_Hant')
>>> s2
'2010年8月28日 B1:45:56'
>>> t1 == t2
False
>>> s1 == s2
True

Actual Results

The B symbol is not formatted.

Expected Results

The B symbol should be formatted to 上午 (am) or 下午 (pm).

Reproducibility

100%

Additional Information

n/a

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions