AW-1844 Fix fmHasPackage
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit

This commit is contained in:
Peter Bastiani 2021-01-18 15:21:34 +01:00
parent 1ade8025ab
commit 0f1ce45b2f
3 changed files with 6 additions and 2 deletions

View File

@ -16,7 +16,7 @@ export class HasPackageDirective implements OnInit,OnDestroy{
private packSub:Subscription; private packSub:Subscription;
ngOnInit() { ngOnInit() {
this.packages$.subscribe((packages) => { 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] && if (packages[this.package] &&
packages[this.package].enabled && packages[this.package].enabled &&
(packages[this.package].DataDate && new Date(packages[this.package].DataDate).setHours(0, 0, 0, 0) <= today) && (packages[this.package].DataDate && new Date(packages[this.package].DataDate).setHours(0, 0, 0, 0) <= today) &&

View File

@ -2,6 +2,8 @@ export interface IPackage {
id:string id:string
name:string; name:string;
enabled?:boolean; enabled?:boolean;
dataDate?:Date;
dataEndDate?:Date;
} }
export interface IPackages { export interface IPackages {

View File

@ -116,6 +116,8 @@ export function reducer(state = initialState, action: appCommonActions.Actions )
let a = action as appCommonActions.InitUserPackagesSuccess; let a = action as appCommonActions.InitUserPackagesSuccess;
let packages = {} let packages = {}
a.items.forEach((item) => { a.items.forEach((item) => {
item.data.dataDate = item.dataDate;
item.data.dataEndDate = item.dataEndDate;
packages[item.data.id]=item.data; packages[item.data.id]=item.data;
}); });