empty date list after emptying calendar list

This commit is contained in:
Tykayn 2022-02-14 10:54:06 +01:00 committed by tykayn
parent 40b3a16e0f
commit 8921348bbb
1 changed files with 14 additions and 11 deletions

View File

@ -733,18 +733,21 @@ export class PollService implements Resolve<Poll> {
*/
convertCalendarToText() {
console.log('this.dateChoiceList', this.dateChoiceList);
// if(!this.dateChoiceList.length){
// return [];
// }
let converted = [];
for (let someDate of this.calendar) {
converted.push(this.DateUtilitiesService.convertDateToDateChoiceObject(someDate));
}
this.dateChoiceList = converted.sort((first: any, second: any) => {
return first.date_object - second.date_object;
});
return converted;
if (this.calendar && this.calendar.length) {
let converted = [];
for (let someDate of this.calendar) {
converted.push(this.DateUtilitiesService.convertDateToDateChoiceObject(someDate));
}
this.dateChoiceList = converted.sort((first: any, second: any) => {
return first.date_object - second.date_object;
});
return converted;
} else {
this.dateChoiceList = [];
}
return this.dateChoiceList;
}
/**