Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

feat(dateFilter): Add option to display date as am/pm #8830

Closed
wants to merge 1 commit into from

Conversation

wesleycho
Copy link
Contributor

This adds a new option in order to choose whether to display a date as
AM/PM or am/pm.

Note: This contains a breaking change. a now will display am/pm,
whereas the old behavior is specified by A for AM/PM.

This is in support of #8763 .

This adds a new option in order to choose whether to display a date as
AM/PM or am/pm.

Fix jshint error

Fix regexp, update docs
@wesleycho wesleycho force-pushed the am_pm_capitalization branch from 9ab8e2e to 763b14f Compare August 29, 2014 06:30
function ampmGetter(date, formats) {
return date.getHours() < 12 ? formats.AMPMS[0] : formats.AMPMS[1];
function ampmGetter(capitalLetters) {
var ampms = (capitalLetters) ? 'AMPMS' : 'ampms';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The property 'ampms' is not defined in any of the locales

@lgalfaso
Copy link
Contributor

There are other issues with the PR, but I think that the biggest one is that the CLDR does not make this distinction. This is why I am closing this PR.

@lgalfaso lgalfaso closed this Aug 29, 2014
@jnraine
Copy link

jnraine commented Sep 12, 2015

@lgalfaso I found myself needing lowercase am/pm today and am interested in adding it. I don't fully understand the issue you've outlined above. Can you explain what the CLDR is and what needs to be added to the built-in i18n locales?

@lgalfaso
Copy link
Contributor

@jnraine the CLDR is the Unicode Common Locale Data Repository that is from where many libraries extract the date/time symbols for the many locales. It also has a reference for many of the date/time patterns, and to do so it defines the symbols, again, commonly used in many libraries (http://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table).

Now, even when the information at the CLDR is very extensive, it does not cover every use case. Eg it does not cover lower case version of the time period (ie, am/pm). It would be close to impossible for an independent library to add and maintain a symbol that is not in the CLDR, as the amount of work would be overwhelming and the benefit would be very limited.

I would recommend you that you just add the filter lowercase to the expression to work around this limitation.

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

Successfully merging this pull request may close these issues.

4 participants