Skip to content

Commit

Permalink
fix: correct upcoming release date after patch releases (#557)
Browse files Browse the repository at this point in the history
fix: correct next release date after patch releases
  • Loading branch information
mdjermanovic committed Apr 23, 2024
1 parent 16b003f commit c621ab9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/_data/stats.json
Expand Up @@ -4,10 +4,10 @@
"currentVersion": "v9.1.1",
"currentVersionDate": "2024-04-22T19:23:14Z",
"currentVersionIsPrerelease": false,
"stars": 24270,
"lastCommitDate": "2024-04-23T02:08:58Z",
"projectDependents": 19255405,
"stars": 24271,
"lastCommitDate": "2024-04-23T10:56:02Z",
"projectDependents": 19264226,
"weeklyDownloads": 38275199,
"nextVersion": "v9.2.0",
"nextVersionDate": "2024-05-10"
"nextVersionDate": "2024-05-03"
}
18 changes: 15 additions & 3 deletions tools/fetch-stats.js
Expand Up @@ -194,9 +194,21 @@ async function fetchGitHubNetworkStats() {

stats.nextVersion = `v${nextVersion}`;

// approximate next release date
stats.nextVersionDate = DateTime.fromISO(stats.currentVersionDate)
.plus({ weeks: 2 }).endOf("week").minus({ days: 2 }).toISODate();
/*
* Calculate next release date.
* We do scheduled releases every two weeks, on Fridays.
* One of the scheduled release dates was Friday, 2024-01-12. We'll use that date as the baseline.
* So, all planned releases are expected to be on 2024-01-12 + n * 14 days.
* Now we'll find the first such day after the current version date.
*/
const baseDate = DateTime.fromISO("2024-01-12");
const currentVersionDate = DateTime.fromISO(stats.currentVersionDate);

stats.nextVersionDate = currentVersionDate
.plus({
days: 14 - currentVersionDate.diff(baseDate, "days").days % 14
})
.toISODate();

await fs.writeFile(statsFilePath, JSON.stringify(stats, null, 4), { encoding: "utf8" });

Expand Down

0 comments on commit c621ab9

Please sign in to comment.