Merge pull request #4284 from MaximilianKrambach/noEnd
fix display of end time
This commit is contained in:
commit
86ee11f9c7
@ -273,11 +273,15 @@ export class ItemRepositoryService extends BaseRepository<ViewItem, Item> {
|
|||||||
* Calculates the estimated end time based on the configured start and the
|
* Calculates the estimated end time based on the configured start and the
|
||||||
* sum of durations of all agenda items
|
* sum of durations of all agenda items
|
||||||
*
|
*
|
||||||
* @returns a Date object
|
* @returns a Date object or null
|
||||||
*/
|
*/
|
||||||
public calculateEndTime(): Date {
|
public calculateEndTime(): Date {
|
||||||
const startTime = this.config.instant<number>('agenda_start_event_date_time'); // a timestamp
|
const startTime = this.config.instant<number>('agenda_start_event_date_time'); // a timestamp
|
||||||
const durationTime = this.calculateDuration() * 60 * 1000; // minutes to miliseconds
|
const duration = this.calculateDuration();
|
||||||
|
if (!startTime || !duration) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
const durationTime = duration * 60 * 1000; // minutes to miliseconds
|
||||||
return new Date(startTime + durationTime);
|
return new Date(startTime + durationTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,10 +257,16 @@ export class AgendaListComponent extends ListViewBaseComponent<ViewItem> impleme
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
const durationString = this.durationService.durationToString(duration);
|
const durationString = this.durationService.durationToString(duration);
|
||||||
const endTimeString = this.repo
|
const endTime = this.repo.calculateEndTime();
|
||||||
.calculateEndTime()
|
const result = `${this.translate.instant('Duration')}: ${durationString}`;
|
||||||
.toLocaleTimeString(this.translate.currentLang, { hour: 'numeric', minute: 'numeric' });
|
if (endTime) {
|
||||||
return `${this.translate.instant('Duration')}: ${durationString} (${this.translate.instant('Estimated end')}:
|
return (
|
||||||
${endTimeString} h)`;
|
result +
|
||||||
|
` (${this.translate.instant('Estimated end')}:
|
||||||
|
${endTime.toLocaleTimeString(this.translate.currentLang, { hour: 'numeric', minute: 'numeric' })} h)`
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user