-
Notifications
You must be signed in to change notification settings - Fork 604
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
12 vs. 24 hour issue, inconsistency of en-GB #51
Comments
Date formatting seems to fail on single characters unless they represent a pattern within
|
Sorry, my description was a bit unclear. There are two issues:
Quoting globalize.js:
So I would expect en-GB to have AM and PM set to null. On the other hand, testing for AM and PM being non-null to decide whether a locale normally uses 12-hour clock is clumsy, and it might be easier to do as CLDR does: the AM and PM designators are defined for all locales, and there is a separate element (property) indicating whether 12-hour or 24-hour clock is normally used. |
I agree that the locale is illogically defined, it should have I guess when you mention there is no way to request a presentation of time in hours, you are thinking of future functionality? |
I meant that here is no way to request a presentation of time in hours culture-specifically, i.e. using 12-hour or 24-hour as regarded normal in a culture. Well, you could programmatically check the definition of pattern ”t” in the locale to see whether it uses ”H” or ”h”, but that would be tricky. |
Yeah, seems like they have it set up to check for AM/PM in order to know if it should be displayed as 12hr time or 24hr time, so it is definitely a bug that "en-GB" doesn't have null values. |
I'm closing this bug since Globalize 1.x is now following CLDR. |
(This relates to issue #41 at least in the sense that considering it, I noticed this discrepancy.)
The en-GB culture uses the H formatting code (24-hour times) for times in the definitions for codes like "t". Yet, it has no explicit setting for the calendar.AM and calendar.PM properties, which means defaulting them to the en (default) locale, which in turn effectively means using 12-hour times.
This means that there's no global way of requesting for, say, a format that consists of hours only, in the locale's hour notation. If the locale definitions were consistent, we could use
function hour(d) {
return Globalize.format(d, Globalize.culture().calendar.AM !== null ? 'h tt' : "''H" );
}
(That is, use 12-hour number followed by AM/PM designator if the locale uses 12-hour times, 24-hour number otherwise.)
The text was updated successfully, but these errors were encountered: