globalizejs / globalizejs/globalize

Mismatch between Globalize and other libraries when dealing with missing skeletons as per TR-35 with dealing with combining date and time patterns

Open
#771 5 comments 0 reactions 0 assignees View on GitHub
uts-35-bug
Dominant language
JavaScript
Stars
4.8k
Forks
585
PR merge metrics
No merged PRs in 30d

Description

Here is another potential spec bug with missing skeletons in Globalize 1.3 which is similar to #764.
See the code sample below:

```
//Setup
const Globalize = require('globalize');
Globalize.load( require( "cldr-data" ).entireSupplemental() );
Globalize.load( require( "cldr-data" ).entireMainFor('it') );
Globalize.locale('it');

const formatterOptions = {
skeleton: 'yMMMMdjmm',
};

// 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);
// 1 gennaio 2017 00:00

console.log(englishDate);
// January 1, 2017 at 12:00 AM
```

Per my read of the TR-35 spec on matching skeletons and what the CLDR data shows, Globalize is doing the right thing. The width of the months is long and there is no weekdays in the above skeleton. However, the output does not match that of iOS and ICU4j which is -

> 1 gennaio 2017, 00:00

I can do a workaround in a manner similar to what was done for #764 but I wanted to highlight this as another potential cause for trouble.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.