Skip to content

Fix date display on the compare page. #1360

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions site/static/compare.html
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,8 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
before() {
if (!this.data) {
const start = findQueryParam("start");
return start ? start.substring(0, 7) : "???";
// 0,10 extracts "YYYY-MM-DD".
return start ? start.substring(0, 10) : "???";
}
if (this.data.a.pr) {
return `#${this.data.a.pr}`;
Expand All @@ -862,12 +863,15 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
return this.formatDate(this.data.a.date);
}

// 0,7 extracts 7 chars from the git commit id/tag, which is probably
// enough to distinguish it. (It is only for display purposes.)
return this.data.a.commit.substring(0, 7);
},
after() {
if (!this.data) {
const end = findQueryParam("end");
return end ? end.substring(0, 7) : "???";
// 0,10 extracts "YYYY-MM-DD".
return end ? end.substring(0, 10) : "???";
}

if (this.data.b.pr) {
Expand All @@ -877,6 +881,8 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
return this.formatDate(this.data.b.date);
}

// 0,7 extracts 7 chars from the git commit id/tag, which is probably
// enough to distinguish it. (It is only for display purposes.)
return this.data.b.commit.substring(0, 7);
},
stat() {
Expand Down