From 0f1ce45b2fef94b9bdc6130a16f624ac4696a476 Mon Sep 17 00:00:00 2001 From: Peter Bastiani Date: Mon, 18 Jan 2021 15:21:34 +0100 Subject: [PATCH] AW-1844 Fix fmHasPackage --- .../src/fm/components/has-package/has-package.directive.ts | 2 +- projects/common/src/fm/models/package.ts | 2 ++ projects/common/src/fm/reducers/app-common.reducer.ts | 4 +++- 3 files changed, 6 insertions(+), 2 deletions(-) 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 9c4a6a8..964ed6c 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,7 @@ export class HasPackageDirective implements OnInit,OnDestroy{ private packSub:Subscription; ngOnInit() { this.packages$.subscribe((packages) => { - const today = new Date(Date.now()).setHours(0,0,0,0); + const today = new Date(Date.prototype.getUTCDate()).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) && diff --git a/projects/common/src/fm/models/package.ts b/projects/common/src/fm/models/package.ts index 921953b..850e5fb 100644 --- a/projects/common/src/fm/models/package.ts +++ b/projects/common/src/fm/models/package.ts @@ -2,6 +2,8 @@ export interface IPackage { id:string name:string; enabled?:boolean; + dataDate?:Date; + dataEndDate?:Date; } export interface IPackages { diff --git a/projects/common/src/fm/reducers/app-common.reducer.ts b/projects/common/src/fm/reducers/app-common.reducer.ts index b2f561b..454150c 100644 --- a/projects/common/src/fm/reducers/app-common.reducer.ts +++ b/projects/common/src/fm/reducers/app-common.reducer.ts @@ -116,7 +116,9 @@ export function reducer(state = initialState, action: appCommonActions.Actions ) let a = action as appCommonActions.InitUserPackagesSuccess; let packages = {} a.items.forEach((item) => { - packages[item.data.id]=item.data; + item.data.dataDate = item.dataDate; + item.data.dataEndDate = item.dataEndDate; + packages[item.data.id]=item.data; }); return tassign(state,{userPackages:packages});