fix: use most Current/LTS with overlapping dates

This commit is contained in:
Nick Schonning 2022-04-20 09:40:11 -04:00
parent 9c4dbb2c42
commit 71fd6418a4
No known key found for this signature in database
GPG Key ID: 5DDAAD9C9AAFFD9F
1 changed files with 6 additions and 2 deletions

View File

@ -30,12 +30,16 @@ midnight.setHours(0, 0, 0, 0)
const now = midnight.getTime()
const aplineRE = new RegExp(/alpine*/);
const slimRE = new RegExp(/\*-slim/);
let foundLTS = false;
let foundCurrent = false;
for (version of versions) {
let lts = new Date(`${config[version].lts}T00:00:00.00`).getTime();
let maintenance = new Date(`${config[version].maintenance}T00:00:00.00`).getTime();
let isCurrent = isNaN(lts) || lts >= now;
let isLTS = (maintenance >= now) && (now >= lts);
let isCurrent = foundCurrent ? false : isNaN(lts) || lts >= now;
foundCurrent = isCurrent || foundCurrent;
let isLTS = foundLTS ? false : (maintenance >= now) && (now >= lts);
foundLTS = isLTS || foundLTS;
let codename = config[version].codename
let defaultAlpine = config[version]['alpine-default']
let defaultDebian = config[version]['debian-default']