Skip to content

Commit 71fd641

Browse files
committed
fix: use most Current/LTS with overlapping dates
1 parent 9c4dbb2 commit 71fd641

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

stackbrew.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,16 @@ midnight.setHours(0, 0, 0, 0)
3030
const now = midnight.getTime()
3131
const aplineRE = new RegExp(/alpine*/);
3232
const slimRE = new RegExp(/\*-slim/);
33+
let foundLTS = false;
34+
let foundCurrent = false;
3335

3436
for (version of versions) {
3537
let lts = new Date(`${config[version].lts}T00:00:00.00`).getTime();
3638
let maintenance = new Date(`${config[version].maintenance}T00:00:00.00`).getTime();
37-
let isCurrent = isNaN(lts) || lts >= now;
38-
let isLTS = (maintenance >= now) && (now >= lts);
39+
let isCurrent = foundCurrent ? false : isNaN(lts) || lts >= now;
40+
foundCurrent = isCurrent || foundCurrent;
41+
let isLTS = foundLTS ? false : (maintenance >= now) && (now >= lts);
42+
foundLTS = isLTS || foundLTS;
3943
let codename = config[version].codename
4044
let defaultAlpine = config[version]['alpine-default']
4145
let defaultDebian = config[version]['debian-default']

0 commit comments

Comments
 (0)