This then means that any other call to cldr.get(). For example - when the currency formatting logic calls cldr.get(), and we pass in an optional CLDR JSON path (ie. one that we won't fail validation if it is not in the CLDR data), it will run validation against the date modules validation, and since the skipPath doesn't contain the correct skipPaths for the currency path, it will assume that it's mandatory and fail validation again.
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.
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:
formatDate() is called with options.skeleton = "yMMM"
This registers a listener event on any call to cldr.get()
As part of dateExpandPattern() we call cldr.get() which invokes validateRequiredCldr
Validation fails with the exception:
E_MISSING_CLDR: Missing required CLDR content 'main/fi-FI/dates/calendars/gregorian/months/stand-alone/abbreviated'.
If this exception is then caught, and the Globalize reference is re-used (as you would do if you wanted to call more functions on the same CLDR data)
The validateRequiredCldr event listener is never un-registered since the un-register code is never executed because the exception was thrown.
This then means that any other call to cldr.get(). For example - when the currency formatting logic calls cldr.get(), and we pass in an optional CLDR JSON path (ie. one that we won't fail validation if it is not in the CLDR data), it will run validation against the date modules validation, and since the skipPath doesn't contain the correct skipPaths for the currency path, it will assume that it's mandatory and fail validation again.
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.