Fix HasPackageDirective
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit

This commit is contained in:
Peter (extern) 2021-01-18 15:01:08 +01:00
parent 41b1295f9e
commit 1ade8025ab

View File

@ -16,7 +16,11 @@ export class HasPackageDirective implements OnInit,OnDestroy{
private packSub:Subscription;
ngOnInit() {
this.packages$.subscribe((packages) => {
if (packages[this.package] && packages[this.package].enabled) {
const today = new Date(Date.now()).setHours(0,0,0,0);
if (packages[this.package] &&
packages[this.package].enabled &&
(packages[this.package].DataDate && new Date(packages[this.package].DataDate).setHours(0, 0, 0, 0) <= today) &&
(packages[this.package].DataEndDate == null || new Date(packages[this.package].DataEndDate).setHours(0, 0, 0, 0) >= today)) {
this.viewContainerRef$.createEmbeddedView(this.templateRef$);
this.hasView=true;
} else if (this.hasView) {