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

Date range type #109

Open
samhh opened this issue Apr 11, 2022 · 1 comment
Open

Date range type #109

samhh opened this issue Apr 11, 2022 · 1 comment

Comments

@samhh
Copy link
Contributor

samhh commented Apr 11, 2022

Example which is different to manually formatting as start – end:

> new Intl.DateTimeFormat('en-US-u-ca-buddhist').formatRange(new Date('1'), new Date('2'))
'1/1/2544 – 2/1/2544 BE'

I haven't been able to find a more common locale that differs however.

@OliverJAsh
Copy link
Member

I haven't been able to find a more common locale that differs however.

How about this?

const longFormat = new Intl.DateTimeFormat("en", { dateStyle: "long" });
longFormat.formatRange(new Date('2020-10-01Z'), new Date('2020-10-20Z'))
// => 'October 1 – 20, 2020'

@samhh samhh removed the discussion label Jun 23, 2022
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