We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Current [minDate] and [maxDate] validation returns misleading error description.
E.g. When [minDate] is set to today and you enter yesterday, validate() returns:
{'ngbDate': {requiredBefore: this.minDate}}
but it should be
{'ngbDate': {requiredAfter: this.minDate}}
Same applies for [maxDate]. When maxDate is set to today and you enter tomorrow you get:
{'ngbDate': {requiredAfter: this.maxDate}}
{'ngbDate': {requiredBefore: this.maxDate}}
The text was updated successfully, but these errors were encountered:
Here is the stackblitz with the issue: https://stackblitz.com/edit/angular-snykrp.
date = 1 OCT 2018 minDate = 10 OCT 2018
I would expect the message to be along these lines:
Currently it is:
FC: { "ngbDate": { "requiredBefore": { "year": 2018, "month": 10, "day": 10 } } }
I'd prefer to change requiredBefore to isBefore, mustBeAfter or simply beforeMinDate.
requiredBefore
isBefore
mustBeAfter
beforeMinDate
I'll leave @pkozlowski-opensource decide. And it is a breaking change.
Sorry, something went wrong.
fix(datepicker): change min/max date error message
19a04f0
Fixes ng-bootstrap#2922 BREAKING CHANGE: 'ngbDate' validator error messages were changed to be more explicit and aligned with Angular validators. For the following use-case `<ngb-datepicker [ngModel]="{year: 2019, month: 12, day: 31}" [minDate]="{year: 2020, month: 1, day: 1}"></ngb-datepicker>` form control errors are: Before ``` ngbDate: { requiredBefore: { year: 2020, month: 1, day: 1 } } ``` After ``` ngbDate: { minDate: { minDate: { year: 2020, month: 1, day: 1 }, actual: { year: 2019, month: 12, day: 31 } } ``` Same change is applied for `requiredAfter` and `maxDate`.
fix(datepicker): change min/max date error message (#3607)
501a1a0
Fixes #2922 BREAKING CHANGE: 'ngbDate' validator error messages were changed to be more explicit and aligned with Angular validators. For the following use-case `<ngb-datepicker [ngModel]="{year: 2019, month: 12, day: 31}" [minDate]="{year: 2020, month: 1, day: 1}"></ngb-datepicker>` form control errors are: Before ``` ngbDate: { requiredBefore: { year: 2020, month: 1, day: 1 } } ``` After ``` ngbDate: { minDate: { minDate: { year: 2020, month: 1, day: 1 }, actual: { year: 2019, month: 12, day: 31 } } ``` Same change is applied for `requiredAfter` and `maxDate`.
maxokorokov
Successfully merging a pull request may close this issue.
Bug description:
Current [minDate] and [maxDate] validation returns misleading error description.
E.g. When [minDate] is set to today and you enter yesterday, validate() returns:
{'ngbDate': {requiredBefore: this.minDate}}
but it should be
{'ngbDate': {requiredAfter: this.minDate}}
Same applies for [maxDate]. When maxDate is set to today and you enter tomorrow you get:
{'ngbDate': {requiredAfter: this.maxDate}}
but it should be
{'ngbDate': {requiredBefore: this.maxDate}}
The text was updated successfully, but these errors were encountered: