AW-3477 fmHasPackage check werkt niet correct voor vandaag
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good Details
FarmMaps/FarmMapsLib/pipeline/head Something is wrong with the build of this commit Details

AW-4620
Willem Dantuma 2022-02-02 18:56:58 +01:00
parent 74c77bae5e
commit b752b377da
1 changed files with 5 additions and 3 deletions

View File

@ -51,7 +51,9 @@ export function getValidPackages(packageMap: IPackages): {[key: string]: IPackag
}
export function isValidPackage(pack: IPackage): boolean {
const today = new Date(new Date(Date.now()).toUTCString()).setHours(0, 0, 0, 0);
return pack !== null && new Date(pack.dataDate).getTime() <= today
&& (!pack.dataEndDate || new Date(pack.dataEndDate).getTime() >= today);
const now = new Date(Date.now());
const utcToday = Date.UTC(now.getUTCFullYear(),now.getUTCMonth(),now.getUTCDate());
return pack !== null && new Date(pack.dataDate).getTime() <= utcToday
&& (!pack.dataEndDate || new Date(pack.dataEndDate).getTime() >= utcToday);
}