Description
i'm changing the used format after the page is done loading (example: DD-MM-YYYY to 00-MM-YYYY) and everything works like a charm except the validator. The validator keeps using the format i used at init.
the code in 'ng2-date-picker.js' that seems to use the wrong format is:
return function (inputVal) { isValid = true; value = _this.convertToMomentArray(inputVal, format, true).filter(Boolean); if (!value.every(function (val) { return val.isValid(); })) { return { format: { given: inputVal } }; } var errors = validators.reduce(function (map, err) { if (!err.isValid()) { map[err.key] = { given: value }; } return map; }, {}); return !isValid ? errors : null; };
i change the config with the code below:
this.datePicker.config = this.datePickerConfig;
When i print this.datePicker.config.format
it shows the new format and the input field displays the new date format correctly as well.
Did i miss something with the new format or is the validation part a bit bugged?