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

This commit is contained in:
Willem Dantuma 2022-02-02 18:56:58 +01:00
parent 74c77bae5e
commit b752b377da

View File

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