-
Notifications
You must be signed in to change notification settings - Fork 593
Open
Labels
Description
Formatters and parsers throw E_MISSING_PARAMETER when any parameter is missing. For example:
Globalize('en').currencyFormatter()
// > currency: E_MISSING_PARAMETER: Missing required parameter `currency`.It happens that it also throws on execution, for example:
var fmt = Globalize('en').currencyFormatter('USD');
fmt();
// > value: E_MISSING_PARAMETER: Missing required parameter `value`.This could be an undesired validation, pointed out by #306. Also, it's a behavior not observed by native JavaScript, for example:
parseFloat();
// > NaN
var fmt = new Intl.DateTimeFormat('en');
fmt.format()
// > "10/10/2015"
fmt = new Intl.NumberFormat('en')
fmt.format()
// > "NaN"Therefore, we could preserve the parameter validations for setup phase, i.e., when formatters or parsers are generated. But, we could drop them for execution and instead use a default like shown above.