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

EU to US times #1257

Open
plaindocs opened this issue Jun 13, 2020 · 7 comments
Open

EU to US times #1257

plaindocs opened this issue Jun 13, 2020 · 7 comments

Comments

@plaindocs
Copy link
Contributor

We've got times of day in a LOT of copy, and often we have to maintain EU and US version, or 12 and 24 hour versions.

We could make a jinja2 / python function along the lines of

>>> print(datetime.strptime('16:00', '%H:%M').time())
16:00:00
>>> print(datetime.strptime('16:00', '%H:%M').strftime("%I:%M %p"))
04:00 PM
>>> 

And then use times like local(16:00) and have it convert or not according to a variable in config. What do you think? Am I over thinking?

@janbrohl
Copy link

Is there actually a problem for US readers reading 24h times? I cannot speak for all europeans but we have and understand 12h clocks, too - just the AM/PM "needs" to be translated then.

For reference:
In Germany we usually just say/write "9" or "9 Uhr" = "9 o'clock" not specifying wether its AM od PM at all or we write "9:15" which implies 24h format.

@plaindocs
Copy link
Contributor Author

It isn't a question of whether US readers can or can't read them , but more a question of presenting the information to them in the way they expect to see it. And 24 hour is definitely stranger to US folks than 12 hour is to European folks.

@ericholscher
Copy link
Member

ericholscher commented Sep 18, 2020

Can't we just do this in Javascript, if needed?

@janbrohl
Copy link

Scanning for ISO formatted times and replacing them with localized representations should work if the times are not divided by tags.

@plaindocs
Copy link
Contributor Author

hmmm, maybe? :-D

@janbrohl
Copy link

janbrohl commented Sep 18, 2020

For me the JS code new Date("1970-01-01 "+"11:00").toLocaleTimeString(); evaluates to "11:00:00". (Date.toLocaleTimeString)
My locale is "de-DE".

Do you get a fitting result for your locale?

@mxsasha
Copy link
Contributor

mxsasha commented Sep 18, 2020

For me it returned 12 hour time, as my browser language was set to English (United States). Don't know if I ever chose that or it was just the default Firefox came with. After setting English (United Kingdom) I get 24 hour time.

If Firefox uses English (United States) as the default, this is not optimal, because Europeans would by default see 12 hour time.

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

4 participants