[develop | DONE | CHANGED] add min/max year variables with default values max: current and min: current -20
This commit is contained in:
parent
f5ca757771
commit
7c3c082fc0
|
@ -50,7 +50,8 @@ export abstract class MonitorIndicatorStakeholderBaseComponent extends Indicator
|
|||
selectedFromAndToValues: ""
|
||||
};
|
||||
rangeFilter: RangeFilterComponent;
|
||||
|
||||
minYear = Dates.currentYear - 20
|
||||
maxYear = Dates.currentYear
|
||||
public numberResults: Map<string, number> = new Map<string, number>();
|
||||
public chartsActiveType: Map<string, IndicatorPath> = new Map<string, IndicatorPath>();
|
||||
public currentYear = new Date().getFullYear();
|
||||
|
@ -179,12 +180,12 @@ export abstract class MonitorIndicatorStakeholderBaseComponent extends Indicator
|
|||
|
||||
protected validateYearRange(navigateTo: boolean = false) {
|
||||
let validYears = true;
|
||||
if (this.periodFilter.selectedToValue && (this.periodFilter.selectedToValue.length == 0 || !Dates.isValidYear(this.periodFilter.selectedToValue, Dates.currentYear - 20, Dates.currentYear))) {
|
||||
this.periodFilter.selectedToValue = Dates.currentYear + "";
|
||||
if (this.periodFilter.selectedToValue && (this.periodFilter.selectedToValue.length == 0 || !Dates.isValidYear(this.periodFilter.selectedToValue, this.minYear, this.maxYear))) {
|
||||
this.periodFilter.selectedToValue = this.maxYear + "";
|
||||
validYears = false;
|
||||
}
|
||||
if (this.periodFilter.selectedFromValue && (this.periodFilter.selectedFromValue.length == 0 || !Dates.isValidYear(this.periodFilter.selectedFromValue, Dates.currentYear - 20, Dates.currentYear))) {
|
||||
this.periodFilter.selectedFromValue = Dates.currentYear - 20 + "";
|
||||
if (this.periodFilter.selectedFromValue && (this.periodFilter.selectedFromValue.length == 0 || !Dates.isValidYear(this.periodFilter.selectedFromValue, this.minYear, this.maxYear))) {
|
||||
this.periodFilter.selectedFromValue = this.minYear + "";
|
||||
validYears = false;
|
||||
}
|
||||
if (this.periodFilter.selectedFromValue && this.periodFilter.selectedFromValue.length && this.periodFilter.selectedToValue && this.periodFilter.selectedToValue.length > 0 && parseInt(this.periodFilter.selectedFromValue, 10) > parseInt(this.periodFilter.selectedToValue, 10)) {
|
||||
|
|
Loading…
Reference in New Issue