Skip to content
New issue

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

narrow non-breaking space (\u202f) usage in datetime formatting #1012

Closed
joeyorlando opened this issue Jun 13, 2023 · 2 comments
Closed

narrow non-breaking space (\u202f) usage in datetime formatting #1012

joeyorlando opened this issue Jun 13, 2023 · 2 comments

Comments

@joeyorlando
Copy link

Overview Description

On version 2.12.1, is it intended that "\u202f" would be included in an en localized datetime?

Steps to Reproduce

>>> import babel
>>> import datetime
>>> now = datetime.datetime.now()
>>> babel.dates.format_datetime(now, format="short", locale="en")
'6/13/23, 3:27\u202fPM'
@joeyorlando
Copy link
Author

seems somewhat related to #1007 ?

@akx
Copy link
Member

akx commented Jun 14, 2023

That formatting comes from the Unicode CLDR data, and Babel itself doesn't have an opinion.

The intention with an NBSP is that the AM/PM marker doesn't wrap onto a second line where it could, e.g. in

6/13/23, 3:27
PM

but remains attached to the time instead, and the user agent would wrap elsewhere:

6/13/23,
3:27 PM

The narrowness is likely a typographic choice.

I'll close this off, but let me know if you have further questions!

@akx akx closed this as completed Jun 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants