AW-3477 fmHasPackage check werkt niet correct voor vandaag

This commit is contained in:
Willem Dantuma 2022-02-02 18:33:05 +01:00
parent 66e492d2f8
commit b191751e02
3 changed files with 18 additions and 17 deletions

20
package-lock.json generated
View File

@ -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"
}

View File

@ -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",

View File

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