Skip to content

Commit

Permalink
fix(TimeFilter): calendar year range, don't reset year range in UI (i…
Browse files Browse the repository at this point in the history
…go2 #359) (#619)

* fix(timeFilter) bug #359

* fix(time-filter-form) withdraw comment

Co-authored-by: Josée Martel <[email protected]>
  • Loading branch information
2 people authored and mbarbeau committed May 11, 2020
1 parent 8c07a9f commit 8091a41
Showing 1 changed file with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export class TimeFilterFormComponent implements OnInit {
constructor() {}

ngOnInit() {

if (this.startDate === undefined) {
const utcmin = new Date(this.min);
this.startDate = new Date(
Expand Down Expand Up @@ -189,9 +190,24 @@ export class TimeFilterFormComponent implements OnInit {
} else {
this.year = new Date(this.min).getFullYear() + 1;
}
} else {
// TODO: FIX THIS for ALL OTHER TYPES STYLES OR RANGE.

} else if (this.isRange && this.style === TimeFilterStyle.CALENDAR && this.type === TimeFilterType.YEAR) {
if (timeFromWms) {
this.startYear = parseInt(timeFromWms.substr(0, 4), 10);
this.endYear = parseInt(timeFromWms.substr(5, 4), 10);
const newStartListYears: any[] = [];
const newEndListYears: any[] = [];
for (let i = this.initStartYear; i < this.endYear; i++) {
newStartListYears.push(i);
}
for (let i = this.startYear + 1; i <= this.initEndYear; i++) {
newEndListYears.push(i);
}
this.startListYears = newStartListYears;
this.endListYears = newEndListYears;
}
}
// TODO: FIX THIS for ALL OTHER TYPES STYLES OR RANGE.
}

handleDateChange(event: any) {
Expand Down

0 comments on commit 8091a41

Please sign in to comment.