From 1ade8025ab24794581a5add8fb816eb42ae65245 Mon Sep 17 00:00:00 2001 From: Peter Bastiani Date: Mon, 18 Jan 2021 15:01:08 +0100 Subject: [PATCH] Fix HasPackageDirective --- .../src/fm/components/has-package/has-package.directive.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/common/src/fm/components/has-package/has-package.directive.ts b/projects/common/src/fm/components/has-package/has-package.directive.ts index 9a4d202..9c4a6a8 100644 --- a/projects/common/src/fm/components/has-package/has-package.directive.ts +++ b/projects/common/src/fm/components/has-package/has-package.directive.ts @@ -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) {