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

Any way to get a date from a locale date string? #454

Closed
tounsoo opened this issue Jan 11, 2023 · 1 comment
Closed

Any way to get a date from a locale date string? #454

tounsoo opened this issue Jan 11, 2023 · 1 comment

Comments

@tounsoo
Copy link

tounsoo commented Jan 11, 2023

I have a following use case:
When I have locale set to en-gb and enter 23/01/2023 I need it to be able to get correct javascript date but I don't see a way to get it using Intl. Maybe there is already a proposal with it? If so please point me to it Thank you!.

// Kinda want something like DateTimeFromLocale
const dateFromEnGB = new Intl.DateTimeFromLocale('en-gb').format('23/01/2023').toFormat({
		day: '2-digit',
		month: '2-digit',
		year: 'numeric',
});
@ptomato
Copy link
Contributor

ptomato commented Jan 11, 2023

Hi, thanks for the suggestion. You're not alone as many people have suggested this; it seems like a simple thing to do but it's actually problematic for several reasons. I recommend you read the discussion in tc39/ecma402#342 as a background. There's also a thread at js-temporal/proposal-temporal-v2#2 to discuss about possibly including a limited version of it in a future proposal.

(I'll close this issue as this isn't the place to request the creation of a proposal — discussion should continue in one of those two places or on our Discourse instance, https://es.discourse.group)

@ptomato ptomato closed this as completed Jan 11, 2023
@ljharb ljharb closed this as not planned Won't fix, can't repro, duplicate, stale Jan 11, 2023
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

3 participants