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

Dates are formatted incorrectly in chrome and desktop client #2096

Closed
bedhub opened this issue Jun 5, 2020 · 4 comments
Closed

Dates are formatted incorrectly in chrome and desktop client #2096

bedhub opened this issue Jun 5, 2020 · 4 comments
Assignees
Labels
bug broken functionality, usability problems, unexpected errors state:tested We tested it and are about to release it
Milestone

Comments

@bedhub
Copy link
Contributor

bedhub commented Jun 5, 2020

Should be 00:46 instead of 24:46. Looks like a bug in chrome but we should try using "hourCycle" property instead of "hour12"

invalid-date-format

Can easily be reproduced in browser console using

tutao.lang.formats.dateTime.format(new Date(2020, 05, 05, 0))

https://support.google.com/chrome/thread/29828561?hl=en

@bedhub bedhub added the bug broken functionality, usability problems, unexpected errors label Jun 5, 2020
@bedhub bedhub added this to the 3.75.x milestone Jun 5, 2020
@bedhub bedhub self-assigned this Jun 15, 2020
@charlag
Copy link
Contributor

charlag commented Jun 18, 2020

hourCycle is a new property, there's a reason why there's no flow definition yet.
Chrome >= 73, FF >= 58, Safari > 13

see here
https://caniuse.com/#feat=mdn-javascript_builtins_intl_datetimeformat_datetimeformat_hourcycle

or here in support table in the bottom
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat

@charlag
Copy link
Contributor

charlag commented Jun 18, 2020

Another option is to append needed hour cycle to the locale name.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#Syntax

@bedhub
Copy link
Contributor Author

bedhub commented Jun 29, 2020

Tested with adding "hc" tag to local name but it seems that the flag is also not supported when hourCycle is not supported (tested with older Safari 11 browser). As older browsers are just ignoring the hourCycle flag when not supported i guess we can just use the implementation from commit 2a40656. All modern browsers now support this flag.

@charlag
Copy link
Contributor

charlag commented Jun 29, 2020

I agree, as long as there are no errors I think we can just use it.

@bedhub bedhub closed this as completed in 267cc84 Jun 29, 2020
@mpfau mpfau added the state:tested We tested it and are about to release it label Jun 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug broken functionality, usability problems, unexpected errors state:tested We tested it and are about to release it
Projects
None yet
Development

No branches or pull requests

3 participants