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

react-intl - formatTime - doesn't use option 'hourCycle' #1695

Closed
alorek opened this issue May 29, 2020 · 1 comment
Closed

react-intl - formatTime - doesn't use option 'hourCycle' #1695

alorek opened this issue May 29, 2020 · 1 comment
Labels

Comments

@alorek
Copy link

alorek commented May 29, 2020

Which package?
react-intl

Describe the bug
not possible to use a 24 hour format with midnight as 00:00 when using locale 'en-US'

root cause:
formatTime and formatDate filter out from options hourCycle

To Reproduce
While using locale 'en-US' I expect to be able to pass hourCycle options to formatTime like:

const date = new Date(Date.UTC(2012, 11, 20, 0, 0, 0));
formatTime(date, {hourCycle: 'h23'})

to get 00:00

this works correctly in Intl.DateTimeFormat i.e.

const date = new Date(Date.UTC(2012, 11, 20, 0, 0, 0));
new Intl.DateTimeFormat('en-US', {hour: '2-digit',
  minute: 'numeric', hourCycle: 'h23'}).format(date)
@alorek alorek added the bug label May 29, 2020
@longlho
Copy link
Member

longlho commented May 29, 2020

Thanks for reporting! We'll take a look asap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants