From b191751e02408d4942188cf8c46247459b64f5a3 Mon Sep 17 00:00:00 2001 From: Willem Dantuma Date: Wed, 2 Feb 2022 18:33:05 +0100 Subject: [PATCH] AW-3477 fmHasPackage check werkt niet correct voor vandaag --- package-lock.json | 20 +++++++++---------- package.json | 8 ++++---- .../common/src/fm/services/package.service.ts | 7 ++++--- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/package-lock.json b/package-lock.json index 750f6b4..926edd7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "farmmaps-lib-app", - "version": "1.1.1", + "version": "1.1.13", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -4079,25 +4079,25 @@ "dev": true }, "@farmmaps/common": { - "version": "1.1.1-prerelease.2031", - "resolved": "https://repository.akkerweb.nl/repository/npm-group/@farmmaps/common/-/common-1.1.1-prerelease.2031.tgz", - "integrity": "sha512-lSmTd2D1/PqzaXBjjY4X6UTYA5joZndXyZpUkFNm/Z0TTFmzFKmiIyGRA9AHX4StdQXC7QsCNfalYN31tnwtuQ==", + "version": "1.1.12", + "resolved": "https://repository.akkerweb.nl/repository/npm-group/@farmmaps/common/-/common-1.1.12.tgz", + "integrity": "sha512-TqPyPv35wK4bM1D/ZnT7zmno12pIlmBVesMKMJF7VtddZUm9mZe890ZQv7JJrbgURhU1o4mBs2ytmW0dGhDArw==", "requires": { "tslib": "^2.0.0" } }, "@farmmaps/common-map": { - "version": "1.1.1-prerelease.2031", - "resolved": "https://repository.akkerweb.nl/repository/npm-group/@farmmaps/common-map/-/common-map-1.1.1-prerelease.2031.tgz", - "integrity": "sha512-BQ2bvNohPth0+oxoSoh+WWLJ/mP2CGW4Qf4xqgC3tgfW+UZfD0dBPl7IT2piuvOuUQzlSVloinCJ4ciZGyZRXg==", + "version": "1.1.12", + "resolved": "https://repository.akkerweb.nl/repository/npm-group/@farmmaps/common-map/-/common-map-1.1.12.tgz", + "integrity": "sha512-mu2AaIrGEbfj7gzJZLwLwBawOWwz4cJXDxcrsZQRzTb8Z9BA3ZV+9w1XkGU7Q0CgYLPuGaWMFF6AHqzTPARj/g==", "requires": { "tslib": "^2.0.0" } }, "@farmmaps/common-map3d": { - "version": "1.1.1-prerelease.2031", - "resolved": "https://repository.akkerweb.nl/repository/npm-group/@farmmaps/common-map3d/-/common-map3d-1.1.1-prerelease.2031.tgz", - "integrity": "sha512-2M5wv5sFwlVwPGlN1b1AGM3Dh/DJFS7+L3b6e6ir2+ASoyy7xhZ67IWS2du8B7y7/xVsgxCJcJp1EJezbSCMAA==", + "version": "1.1.12", + "resolved": "https://repository.akkerweb.nl/repository/npm-group/@farmmaps/common-map3d/-/common-map3d-1.1.12.tgz", + "integrity": "sha512-yHRrL97GQZj0m4AlhsNrnKL6aujCBr5qgbp7uiUqsSQXp2dpJXbUFZpPnPKvOrFDUNJl8gqsbo5cvsvHucqCYg==", "requires": { "tslib": "^2.0.0" } diff --git a/package.json b/package.json index 78d7249..0421cf2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "farmmaps-lib-app", - "version": "1.1.12", + "version": "1.1.13", "scripts": { "ng": "ng", "start": "ng serve", @@ -19,9 +19,9 @@ "@angular/platform-browser": "~11.2.14", "@angular/platform-browser-dynamic": "~11.2.14", "@angular/router": "~11.2.14", - "@farmmaps/common": "1.1.4", - "@farmmaps/common-map": "1.1.4", - "@farmmaps/common-map3d": "1.1.4", + "@farmmaps/common": "1.1.12", + "@farmmaps/common-map": "1.1.12", + "@farmmaps/common-map3d": "1.1.12", "@microsoft/signalr": "^3.1.16", "@ng-bootstrap/ng-bootstrap": "^9.0", "@ngrx/effects": "^11.0", diff --git a/projects/common/src/fm/services/package.service.ts b/projects/common/src/fm/services/package.service.ts index 588e49e..82c92f5 100644 --- a/projects/common/src/fm/services/package.service.ts +++ b/projects/common/src/fm/services/package.service.ts @@ -51,7 +51,8 @@ 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); }