fix sort compare

This commit is contained in:
Tykayn 2021-11-17 17:08:42 +01:00 committed by tykayn
parent b1b6ec650a
commit bf8c6a9b7a
2 changed files with 3 additions and 3 deletions

View File

@ -670,7 +670,7 @@ export class PollService implements Resolve<Poll> {
converted.push(this.DateUtilitiesService.convertDateToDateChoiceObject(someDate)); converted.push(this.DateUtilitiesService.convertDateToDateChoiceObject(someDate));
} }
this.dateChoiceList = converted.sort((first: any, second: any) => { this.dateChoiceList = converted.sort((first: any, second: any) => {
return second.date_object < first.date_object; return first.date_object - second.date_object;
}); });
return converted; return converted;

View File

@ -144,8 +144,8 @@ export class DayListComponent {
this.dateUtilitiesService.addDaysToDate(1, lastDateChoiceObject) this.dateUtilitiesService.addDaysToDate(1, lastDateChoiceObject)
) )
); );
this.pollService.dateChoiceList = this.pollService.dateChoiceList.sort((a: any, b: any) => { this.pollService.dateChoiceList.sort((a: any, b: any) => {
return b.date_object < a.date_object; return a.date_object - b.date_object;
}); });
this.focusOnChoice(this.storageService.dateChoices.length - 1); this.focusOnChoice(this.storageService.dateChoices.length - 1);
} }