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 (extern) 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;
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) &&

View File

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

View File

@ -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});