AW-3477 fmHasPackage check werkt niet correct voor vandaag
This commit is contained in:
parent
74c77bae5e
commit
b752b377da
@ -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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user