From 4a1390e1a7ac7e1f9b21f43f59138ebad529e541 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Mon, 7 Nov 2016 16:39:24 -0500 Subject: [PATCH] Fix logs view for dates that start in zero Fixes #2081 --- static/js/graphing.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/static/js/graphing.js b/static/js/graphing.js index e179ff1cc..4ed68ab16 100644 --- a/static/js/graphing.js +++ b/static/js/graphing.js @@ -1126,7 +1126,12 @@ LogUsageChart.prototype.buildData_ = function(aggregatedLogs) { var title = this.titleMap_[aggregated.kind] || aggregated.kind; var datetime = parseDate(aggregated.datetime); - var formatted = (datetime.getMonth() + 1) + '/' + datetime.getDate(); + var day = datetime.getDate(); + if (day < 10) { + day = '0' + day; + } + + var formatted = (datetime.getMonth() + 1) + '/' + day; var justdate = new Date(datetime.getFullYear(), datetime.getMonth(), datetime.getDate()); var key = title + '_' + formatted; var entry = { @@ -1205,10 +1210,6 @@ LogUsageChart.prototype.buildData_ = function(aggregatedLogs) { * Renders the tooltip when hovering over an element in the chart. */ LogUsageChart.prototype.renderTooltip_ = function(d, e) { - if (e[0] == '0') { - e = e.substr(1); - } - var key = d + '_' + e; var entry = this.entryMap_[key]; if (!entry) {