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 602 forks source link

Validation listener is not un-registered in the event of a validation failure #878

Closed robaw closed 4 years ago

robaw commented 5 years ago

We should fix a bug in Globalize were exceptions being thrown within the CLDR validation logic causes further validation to be handled incorrectly.

How this happens:

For example, when we now (after the date validation has failed and we haven't un-registered the date.validateRequiredCldr() listener on cldr.get()) try to validate the path "supplemental/currencyData/fractions/RUB", since we end up validating this path against the date module's validateRequiredCldr function, we end up using the wrong skipPath. If we used the currency validator's skipPath then we wouldn't then throw an exception, since this path is on the currency validator's skipPath, and so would be skipped.

robaw commented 5 years ago

image