Need API to find out the hour cycle (h11, h12, h23, or h24) of a given locale

Description

https://ecma-international.org/ecma-402/

has the concept of "default hourCycle setting" of a given Locale.
"
The default hourCycle setting per locale (12.3.3)
...
Let hcDefault be dataLocaleData.[[hourCycle]].
"
We need an API to get such default hour cycle for a given Locale.

Activity

Show:
Frank Yung-Fong Tang
December 17, 2019, 11:25 PM

fixed in

Shane Carr
November 1, 2019, 6:20 PM

Seems consistent with upstream CLDR:

https://github.com/unicode-org/cldr/blob/master/common/supplemental/supplementalData.xml#L4757

So yes, the data suggests that no locale prefers hc24 or hc11

Frank Yung-Fong Tang
October 28, 2019, 11:35 PM

Mark - need more help here

According to http://userguide.icu-project.org/formatparse/datetime

h

hour in am/pm (1~12)

h
hh

7
07

H

hour in day (0~23)

H
HH

0
00

k

hour in day (1~24)

k
kk

24
24

K

hour in am/pm (0~11)

K
KK

0
00

but

$ egrep preferred third_party/icu/source/data/misc/supplementalData.txt|sort -u

preferred{"h"}

preferred{"H"}

show me only h or H, which mean either “hour in am/pm (1~12)” or “hour in day (0~23)”

but I don’t see any value of “k” or “K”.

so… is this true there are no locale prefer 1-24 (hc24) or 0-11 (hc11)?

or there are something else I need to look into?

Mark Davis
February 20, 2019, 7:12 PM

The data is in CLDR as <timeData>, and copied into ICU data. So the implementation is fairly straightforward.

There are two pieces of information:

<hours preferred="H" allowed="H hb hB h" regions="AF LA"/>

allowed is in priority order
preferred is for backwards compatibility, when the client doesn't support *b or *B

Fixed

Assignee

Frank Yung-Fong Tang

Reporter

Frank Yung-Fong Tang

Components

Reviewer

Mark Davis

Priority

major

Time Needed

Days

Fix versions