Skip to content

Commit

Permalink
Fix Kaitai WebIDE commit date.
Browse files Browse the repository at this point in the history
  • Loading branch information
jchv committed Sep 3, 2019
1 parent e7726a4 commit 3443fd9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion build.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ function fetchGitCommitInfo() {
);
}

function formatCommitDate(d) {
return String(d.getUTCFullYear()).padEnd(2, 0) + '-'
+ String(d.getUTCMonth() + 1).padEnd(2, 0) + '-'
+ String(d.getUTCDate()).padEnd(2, 0) + ' '
+ String(d.getUTCHours()).padEnd(2, 0) + ':'
+ String(d.getUTCMinutes()).padEnd(2, 0) + ':'
+ String(d.getUTCSeconds()).padEnd(2, 0);
}

async function main() {
const { commitId, commitDate } = await fetchGitCommitInfo();
const scriptAppend =
Expand All @@ -69,7 +78,7 @@ async function main() {
)
.replace(
'kaitaiIde.commitDate = "";',
`kaitaiIde.commitDate = "${commitDate}";`
`kaitaiIde.commitDate = "${formatCommitDate(commitDate)}";`
)
);
}
Expand Down

0 comments on commit 3443fd9

Please sign in to comment.