We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The "b" format symbol to format_time and format_datetime (with locale="en") currently produces one of morning, noon, evening, or midnight.
format_time
format_datetime
locale="en"
morning
noon
evening
midnight
The CLDR docs say the result should be one of am, noon, pm, or midnight.
am
pm
(The latter behavior seems more useful.)
import datetime from babel.dates import format_time print(format_time(datetime.time(6), "h:mm b", locale="en"))
6:00 morning
6:00 am
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).
Comments:
"6:00 am", "12:00 noon", "6:00 pm", "12:00 midnight"
"6:00 morning", "6:00 evening"
"in the evening"
The text was updated successfully, but these errors were encountered:
Hi, if this issue is still available I would like to be assigned to it.
Sorry, something went wrong.
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'
No branches or pull requests
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"
.The text was updated successfully, but these errors were encountered: