Skip to content

validator using old format #405

Closed
Closed
@ydg2018

Description

@ydg2018

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?

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions