globalizejs / globalize

A JavaScript library for internationalization and localization that leverages the official Unicode CLDR JSON data
https://globalizejs.com
MIT License
4.8k stars 603 forks source link

Error using "MMMM" with skeleton in date formatting. #718

Closed jsearles closed 7 years ago

jsearles commented 7 years ago

This code generates an error using version 1.2.3 of Globalize:

Globalize.dateFormatter({ skeleton: "MMMM" })(new Date())

The error is "E_UNSUPPORTED: Unsupported {"feature":"year pattern u"}." which occurs because in the dateExpandPattern this line turns the pattern into "undefined at undefined":

                result = combineDateTime( type,
                    cldr.main([
                        "dates/calendars/gregorian/dateTimeFormats/availableFormats",
                        dateSkeleton
                    ]),
                    cldr.main([
                        "dates/calendars/gregorian/dateTimeFormats/availableFormats",
                        timeSkeleton
                    ])
                );

This happens in Chrome (v59), Firefox (v53), and Node (v4.4.5).

rxaviers commented 7 years ago

Thanks for filing this issue. This is fixed in master (and in 1.3.0-alpha.3), coming in 1.3.0 soon.