You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 14, 2021. It is now read-only.
Interestingly, the output is what we have in pattern, instead of pattern12, which conflicts with the default value of hour12 for that locale, and the entry in the resolved format which is set to true as well. I will expect this to use pattern12 instead. But even if we fix that, the main problem remains, which is, hour should have been set to 2-digit instead of numeric.
More investigation on this shows that if we modify the options to set hour to 2-digit explicitly, as in the following code:
new IntlPolyfill.DateTimeFormat('fr-FR', {
hour: '2-digit',
minute: 'numeric'
}).format(new Date('2000/12/12 09:09'));
It resolves to another format, this time the correct one, which correspond to the short entry in timeFormats, which is equal to: "HH:mm", link here:
When analyzing the difference in weight from the two patterns for the first example, I found something weird when debugging the best match for the following structure:
which makes sense, but if hour12 were considered, they should have similar weight, and the first one matches the hour12 value. I wonder if we are missing something here.
The text was updated successfully, but these errors were encountered:
this is related to issue #109
@andyearnshaw I have done some debugging on the issue described in issue #109, and here are some preliminary thoughts:
When trying to format a time in french using this code:
It will resolve to one of the formats under
availableFormats
, specifically, the pattern"h:mm a"
from this line:Intl.js/locale-data/json/fr-FR.json
Line 49 in 41e1bb2
As a result, the internal representation of the format is:
Interestingly, the output is what we have in
pattern
, instead ofpattern12
, which conflicts with the default value ofhour12
for that locale, and the entry in the resolved format which is set to true as well. I will expect this to usepattern12
instead. But even if we fix that, the main problem remains, which is,hour
should have been set to2-digit
instead ofnumeric
.More investigation on this shows that if we modify the options to set
hour
to2-digit
explicitly, as in the following code:It resolves to another format, this time the correct one, which correspond to the
short
entry intimeFormats
, which is equal to:"HH:mm"
, link here:Intl.js/locale-data/json/fr-FR.json
Line 75 in 41e1bb2
As a result, it produces this:
And everything looks correct.
When analyzing the difference in weight from the two patterns for the first example, I found something weird when debugging the best match for the following structure:
[[hour12]]
is not taken in consideration for the weighting, as a result, the following format weight lessthan
which makes sense, but if
hour12
were considered, they should have similar weight, and the first one matches thehour12
value. I wonder if we are missing something here.The text was updated successfully, but these errors were encountered: