Commit 42ac344a authored by indigane's avatar indigane Committed by Jacques Erasmus

Fix ambiguous dates in commit graph

parent d800938c
...@@ -98,6 +98,7 @@ export default class BranchGraph { ...@@ -98,6 +98,7 @@ export default class BranchGraph {
let len = 0; let len = 0;
let cuday = 0; let cuday = 0;
let cumonth = ''; let cumonth = '';
let cuyear = '';
const { r } = this; const { r } = this;
r.rect(0, 0, 40, this.barHeight).attr({ r.rect(0, 0, 40, this.barHeight).attr({
fill: '#222', fill: '#222',
...@@ -108,24 +109,21 @@ export default class BranchGraph { ...@@ -108,24 +109,21 @@ export default class BranchGraph {
const ref = this.days; const ref = this.days;
for (mm = 0, len = ref.length; mm < len; mm += 1) { for (mm = 0, len = ref.length; mm < len; mm += 1) {
const day = ref[mm]; const day = ref[mm];
if (cuday !== day[0] || cumonth !== day[1]) { if (cuday !== day[0] || cumonth !== day[1] || cuyear !== day[2]) {
// Dates // Dates
r.text(55, this.offsetY + this.unitTime * mm, day[0]).attr({ r.text(55, this.offsetY + this.unitTime * mm, day[0]).attr({
font: '12px Monaco, monospace', font: '12px Monaco, monospace',
fill: '#BBB', fill: '#BBB',
}); });
[cuday] = day;
} }
if (cumonth !== day[1]) { if (cumonth !== day[1] || cuyear !== day[2]) {
// Months // Months
r.text(20, this.offsetY + this.unitTime * mm, day[1]).attr({ r.text(20, this.offsetY + this.unitTime * mm, day[1]).attr({
font: '12px Monaco, monospace', font: '12px Monaco, monospace',
fill: '#EEE', fill: '#EEE',
}); });
// eslint-disable-next-line prefer-destructuring
cumonth = day[1];
} }
[cuday, cumonth, cuyear] = day;
} }
this.renderPartialGraph(); this.renderPartialGraph();
return this.bindEvents(); return this.bindEvents();
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<%= raw( <%= raw(
{ {
days: @graph.days.compact.map { |d| [d.day, d.strftime("%b")] }, days: @graph.days.compact.map { |d| [d.day, d.strftime("%b"), d.year] },
commits: @graph.commits.map do |c| commits: @graph.commits.map do |c|
{ {
parents: parents_zip_spaces(c.parents(@graph.map), c.parent_spaces), parents: parents_zip_spaces(c.parents(@graph.map), c.parent_spaces),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment