From b752b377da94e3fb5426e23684cbf5dff6869632 Mon Sep 17 00:00:00 2001 From: Willem Dantuma Date: Wed, 2 Feb 2022 18:56:58 +0100 Subject: [PATCH] AW-3477 fmHasPackage check werkt niet correct voor vandaag --- projects/common/src/fm/services/package.service.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/projects/common/src/fm/services/package.service.ts b/projects/common/src/fm/services/package.service.ts index 588e49e..ef8552e 100644 --- a/projects/common/src/fm/services/package.service.ts +++ b/projects/common/src/fm/services/package.service.ts @@ -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); + }