From 3be94f076c79a14833a6ee8b34f3be0795938430 Mon Sep 17 00:00:00 2001 From: Brian David Date: Thu, 20 Aug 2020 21:13:56 -0500 Subject: [PATCH] [#238] Updates date-fns formats to fix rank graph --- src/model/user.js | 2 +- src/ui/user/UserRankGraph.js | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/model/user.js b/src/model/user.js index e8acc96..98af90c 100644 --- a/src/model/user.js +++ b/src/model/user.js @@ -178,7 +178,7 @@ export function parseRankGraph(data: Array): RankGraph { // Create a list of the unique months present in the graph data for labeling newRankGraph.months = []; series.forEach((d) => { - let str = dateFormat(d.x, "MMMM YYYY"); + let str = dateFormat(d.x, "MMMM yyyy"); if (newRankGraph.months.indexOf(str) === -1) { newRankGraph.months.push(str); } diff --git a/src/ui/user/UserRankGraph.js b/src/ui/user/UserRankGraph.js index 9c9aeb7..257e9cc 100644 --- a/src/ui/user/UserRankGraph.js +++ b/src/ui/user/UserRankGraph.js @@ -71,14 +71,14 @@ export default class UserRankGraph extends Component { divisor: series.length, labelInterpolationFnc: function (value, index) { const d = new Date(value); - const day = dateFormat(d, "DD"); + const day = dateFormat(d, "dd"); const month = dateFormat(d, "MMM"); // When we have multiple months of rank data if (months.length > 2) { // Only show the year for January and the first month on // the graph - const format = index < 31 || month === "Jan" ? "MMM YYYY" : "MMM"; + const format = index < 31 || month === "Jan" ? "MMM yyy" : "MMM"; // Show the label only on the first day of the month return day === "01" ? dateFormat(d, format) : null; @@ -89,12 +89,12 @@ export default class UserRankGraph extends Component { let ratio = series.length / ticks; if (index === 0) { - format = "MMM D, YYYY"; + format = "MMM d, yyyy"; } else { if (day === "01") { - format = "MMM D"; + format = "MMM d"; } else { - format = "MMM D"; + format = "MMM d"; } } return Math.floor(index % ratio) === 0