angular / angular

Deliver web apps with confidence 🚀
https://angular.dev
MIT License
96.09k stars 25.43k forks source link

Date pipe: add skeleton formats #19823

Closed JohnKis closed 3 years ago

JohnKis commented 7 years ago

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[x] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

Date pipe doesn't offer a way to use custom date formats that respect the ordering of the date components according to the locale.

Expected behavior

There should be a way to specify a custom format while keeping ordering of the locale. In #11661 it was suggested that this should be achievable by adding support for CLDR skeletons (see "Additional Date-Time Formats" in http://cldr.unicode.org/translation/date-time-patterns)

The following example illustrates the expected output of the pipe with and without respecting the ordering of the locale:

// LOCALE_ID: 'en-GB'
{{ date | date:'EEE d MMM' }}
// Current: Tue 20 Oct
// Locale ordering: Tue 20 Oct

// LOCALE_ID: 'en-US'
{{ date | date:'EEE d MMM' }}
// Current: Tue 20 Oct
// Locale ordering: Tue, Oct 20

// LOCALE_ID: 'hu-HU'
{{ date | date:'EEE d MMM' }}
// Current: K 20 okt.
// Locale ordering: okt. 20., K

Minimal reproduction of the problem with instructions

What is the motivation / use case for changing the behavior?

I believe it would be a useful feature for internationalised apps. For instance, I have multiple apps that render only specific date components that cannot be expressed using a standard format.

Environment


Angular version: 4.1.3
It is still the case in the most recent Angular version
Browser:
- [x] Chrome (desktop) version XX
- [x] Chrome (Android) version XX
- [x] Chrome (iOS) version XX
- [x] Firefox version XX
- [x] Safari (desktop) version XX
- [x] Safari (iOS) version XX
- [x] IE version XX
- [x] Edge version XX

For Tooling issues:
- Node version: v6.3.0
- Platform: Mac

Others:

ocombe commented 7 years ago

To do that we may have to add the available formats to the extra locale data files: https://github.com/unicode-cldr/cldr-dates-full/blob/master/main/en/ca-generic.json#L333 and then follow this guide to use the correct format: http://www.unicode.org/reports/tr35/tr35-dates.html#availableFormats_appendItems

angular-robot[bot] commented 3 years ago

Just a heads up that we kicked off a community voting process for your feature request. There are 20 days until the voting process ends.

Find more details about Angular's feature request process in our documentation.

angular-robot[bot] commented 3 years ago

Thank you for submitting your feature request! Looks like during the polling process it didn't collect a sufficient number of votes to move to the next stage.

We want to keep Angular rich and ergonomic and at the same time be mindful about its scope and learning journey. If you think your request could live outside Angular's scope, we'd encourage you to collaborate with the community on publishing it as an open source package.

You can find more details about the feature request process in our documentation.

petebacondarwin commented 3 years ago

It doesn't look like there is much interest in this feature, and it would increase the size of our local files and code in @angular/common to handle it.

angular-automatic-lock-bot[bot] commented 3 years ago

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.