globalizejs / globalizejs/globalize
Unexpected matching in Polish format in Globalize
- Dominant language
- JavaScript
- Stars
- 4.8k
- Forks
- 585
- PR merge metrics
- No merged PRs in 30d
Description
Polish (pl) for the format (yLLL) has the following issue -
Given that M and L has a small distance from each other, I would expect the format to be "LLL y". However, for Polish I am seeing unexpected results
These are the results I am seeing with Globalize
> yMMM (01 Jan 2017) -> 01.2017
> yLLL (01 Jan 2017) -> sty.2017
While ICU4j has the results as -
> yLLL (01 Jan 2017) -> sty 2017
For yMMM, we are getting the closest result as yM -> "MM.y". This is already pretty strange considering the data has "yMMM" -> "LLL y".
Now, yLLL is matching to yM and then replacing MM with LLL (which is totally strange).
See the code sample below -
```
//Setup
const Globalize = require('globalize');
Globalize.load( require( "cldr-data" ).entireSupplemental() );
Globalize.load( require( "cldr-data" ).entireMainFor('pl') );
Globalize.locale('pl');
const formatterOptions = {
skeleton: 'yLLL',
};
// Create a localized formatter.
const f = Globalize.dateFormatter(formatterOptions);
// Format a localized date
const localDate = f(new Date(2017,00,01));
// Setup en-US data
Globalize.load( require( "cldr-data" ).entireMainFor('en') );
Globalize.locale('en-US');
// Create an english formatter
const f2 = Globalize.dateFormatter(formatterOptions);
const englishDate = f2(new Date(2017,00,01));
console.log(localDate);
// sty.2017
console.log(englishDate);
// Jan 2017
```
Contributor guide
Assessment
This issue has not been assessed yet.