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

Intl.DateTimeFormat.formatRange polyfill doesn't match web reality #2915

Open
longlho opened this issue May 23, 2021 · 2 comments
Open

Intl.DateTimeFormat.formatRange polyfill doesn't match web reality #2915

longlho opened this issue May 23, 2021 · 2 comments

Comments

@longlho
Copy link
Member

longlho commented May 23, 2021

const date1 = new Date(Date.UTC(2021, 4, 19, 9, 0)) // "May 19, 2021, 9 AM"
const date2 = new Date(Date.UTC(2021, 5, 19, 17, 0)) // "Jun 19, 2021, 5 PM"
const dtf = new DateTimeFormat('en', {
  hour: 'numeric',
  minute: 'numeric',
  timeZone: 'America/New_York',
})
dtf.formatRange(date1, date2) // Should return 5/19/2021, 5:00 AM – 6/19/2021, 1:00 PM but right now returning 5:00 AM - 1:00 PM
@github-actions
Copy link

github-actions bot commented Jun 8, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@CoatedMoose
Copy link

I have the same issue as #2962, but it is marked as a duplicate of this issue.

The example on this issue describes a range spread across days only showing the time part(s), while the issue I have is that a range (1h, same day) should only show the date part(s) once. Are these actually the same issue?

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

No branches or pull requests

2 participants