Open dairiki opened 10 months ago
Hi, if this issue is still available I would like to be assigned to it.
That is not a defect. In CLDR 42, morning
is declared for period 6:00 <= time < 12:00 of "en" locale.
>>> import babel
>>> babel.__version__
'2.12.1'
>>> import datetime
>>> from babel import dates
>>> dates.format_time(datetime.time(5, 59, 59), 'h:mm b', locale='en')
'5:59 night'
>>> dates.format_time(datetime.time(6, 0, 0), 'h:mm b', locale='en')
'6:00 morning'
>>> dates.format_time(datetime.time(11, 59, 59), 'h:mm b', locale='en')
'11:59 morning'
>>> dates.format_time(datetime.time(12, 0, 0), 'h:mm b', locale='en')
'12:00 noon'
>>> dates.format_time(datetime.time(12, 0, 1), 'h:mm b', locale='en')
'12:00 afternoon'
>>> dates.format_time(datetime.time(17, 59, 59), 'h:mm b', locale='en')
'5:59 afternoon'
>>> dates.format_time(datetime.time(18, 0, 0), 'h:mm b', locale='en')
'6:00 evening'
>>> dates.format_time(datetime.time(20, 59, 59), 'h:mm b', locale='en')
'8:59 evening'
>>> dates.format_time(datetime.time(21, 0, 0), 'h:mm b', locale='en')
'9:00 night'
Overview Description
The "b" format symbol to
format_time
andformat_datetime
(withlocale="en"
) currently produces one ofmorning
,noon
,evening
, ormidnight
.The CLDR docs say the result should be one of
am
,noon
,pm
, ormidnight
.(The latter behavior seems more useful.)
Steps to Reproduce
Actual Results
6:00 morning
Expected Results
6:00 am
Reproducibility
Babel versions 2.10.2 through 2.12.1 all behave consistently. Versions prior to 2.10.2 do not support the "b" field at all (#869).
Additional Information
Comments:
"6:00 am", "12:00 noon", "6:00 pm", "12:00 midnight"
seems more usable than"6:00 morning", "6:00 evening"
."in the evening"
.