Skip to content

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

Closed

Description

@joeyorlando

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'

Activity

  1. joeyorlando commented on Jun 13, 2023

    @joeyorlando
    Author

    seems somewhat related to #1007 ?

  2. akx commented on Jun 14, 2023

    @akx
    Member

    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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions