tc39 / proposal-intl-locale-info

An API to expose information of locale, such as week data ( first day of a week, weekend start, weekend end), hour cycle, measurement system, commonly used calendar, etc.
MIT License
56 stars 11 forks source link

Reverse date creation #66

Closed tounsoo closed 1 year ago

tounsoo commented 1 year ago

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 this can be something this proposal can cover?

// 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',
});
FrankYFTang commented 1 year ago

@ben-allen This seems a date parsing requirement and should be filed in https://github.com/tc39/ecma402 instead. I am going to close it for this repo.